freenode/#lisp - IRC Chatlog
Search
19:51:20
jmercouris
it appears more expensive on paper, but that is the true price, and they won't play games with you when it comes to insurance claims, upselling, and the like
19:52:36
sjl
I might rent a car anyway. I took the entire week off from work, so after ELS I might go to Florence and visit some of the math-related museums.
19:59:09
lumonom
Hey i am really new here so pls tell me if i do something wrong. I wanted to ask if there is an easy way to check if a float number only has a 0 after the decimal point
20:47:52
makomo
check out the section "understanding compiler diagnostics" or something similar in SBCL's manual
20:49:51
makomo
yeah, in any case, it's not seeing DEFTABLE as a macro but as a normal function, so it goes on to examine the arguments
20:50:02
jmercouris
I'm going to clear my cache and recompile on my own machine and see if I have issues
20:52:11
jmercouris
though it may be faster this time, since all of the dependencies are compiled, I'll do it as a last resort
20:58:52
dxtr
Can I do something like (loop for (a b) on '((1 2 3 4))) where (a b) has a length that depends on a variable?
21:00:47
makomo
dxtr: assuming arbitrary lengths, would you then access the destructured elements? you wouldn't know how many to destructure
21:01:38
makomo
LOOP's destructuring acts (almost, there's some corner case or something) like destructuring-bind's, so you can use stuff like &optional, etc.
21:01:50
dxtr
Well, if I could catch them as a list then that'd be great because that's essentially what I want to do
21:04:13
sjl
I don't think it's true that you can portably use destructuring-bind type stuff in LOOP binding clauses
21:04:38
sjl
Destructuring allows binding of a set of variables to a corresponding set of values anywhere that a value can normally be bound to a single variable. During loop expansion, each variable in the variable list is matched with the values in the values list. If there are more variables in the variable list than there are values in the values list, the remaining variables are given a value of nil. If there are more
21:06:31
sjl
You can use a dotted list to do the equivalent of &rest, and you can use NIL to ignore values, but it's not full destructuring-bind level of power.
21:07:44
dxtr
Well if it's not possible it's not possible. Just figured that it doesn't hurt to ask so I don't re-invent stuff that exists
21:09:28
sjl
dxtr: it's still not clear what you're trying to do. That example will return '((1 2) (2 3) ... (9 10) (10 nil)). Is that not what you want?
21:09:48
makomo
dxtr: i'm not completely sure what you want to do. the example you gave above evaluates without errors. i was expecting an example where you provide the destructuring, the input and the values of A and B you want
21:12:26
Bike
well, you can't get a bunch of variables (like A and B) from a number, you'd get a subsequence
21:12:36
sjl
There's no way to do that kind of thing with destructuring, no. You could do something like:
21:12:52
sjl
(defun ngrams (n list) (loop :for x :on list :repeat (- (length list) n) :collect (take n x)))
21:13:35
Bike
you could do (loop for sublist on list by (lambda (l) (nthcdr n l)) for real-sublist = (subseq sublist 0 n) ...work with real-sublist here...)
21:13:49
makomo
dxtr: as mentioned, you can't really do that with destructuring. the problem is that X is a run-time thing, while the destructuring specification has to be known at compile-time, at the moment you write the code (and "tricks" like &rest don't really help here)
4:22:25
aeth
So this seems to work as a way to run something in another thread but the consing quickly adds up so it's clearly not supposed to be done in a big loop: (defun my-thread () (loop (bt:with-lock-held (*world*) (bt:condition-wait *hello* *world*)) (format t "Hello!~%")))
4:23:49
aeth
Is there a better way to tell a thread to wait to resume until it's told to do so by another thread? One that's more loop-friendly.
4:28:51
pjb
aeth: condition-wait is the way to do it. However you have to be careful if several threads wait on the same condition, since it's random which will wake on signaling the condition.
4:30:31
aeth
pjb: What I like about condition-wait is that every subthread can be written like a loop, just like the outer controlling loop. What I don't like about it is: (1) it would be tricky to coordinate e.g. 127 child threads since they'd all need their own name to be awken that way
4:31:25
aeth
and (3) in SBCL it appears to cons a decent measurable amount *each* iteration of the loop, so for something that's a quick calculation meant to be run very frequently, this is going to be very suboptimal
4:57:44
emaczen
I'm using cffi:define-foreign-library and cffi:use-foreign-library no differently than I have in the past, but for some reason when I asdf:load-system my system with the foreign-libraries lisp just hangs
4:58:46
emaczen
Strangely, the compilation reports that it has cached the fasl so if I restart, it will successfully load the cached version
5:02:45
emaczen
It looks like the use-foreign-library form is what is hanging (if I comment it out and try asdf:load-system) but even when I leave it in, the forms following are compiled/loaded but it just hangs...
5:49:16
emaczen
Related to what I asked about an hour ago, I decided to try loading my system with my own loader rather than ASDF (my loader doesn't know how to load CFFI, so I used ASDF to load CFFI first before loading my system) and I'm not getting any hangs
6:18:22
PuercoPop
yeah, its an external contrib. (I'm using the Sly port of said contrib. Just expanded a macrolet)
6:20:03
PuercoPop
https://github.com/joddie/macrostep The macrostep repo appears to have the Slime support included
6:28:12
emaczen
What is the correct method to customize when a defclass form is evaluated? I tried ensure-class-using-class with my metaclass being the first specializer, and it works, but only after the defclass form has been evaluated once (which is because of the way ensure-class is defined by default)
6:50:24
emaczen
phoe: I'm reading the definitions of sb-mop:ensure-class and sb-mop:ensure-class-using-class
6:52:10
emaczen
The reason why, is because the metaclass object in (defmethod ensure-class-using-class ((class null) name &rest args &key) ...) has type standard-class
6:53:02
emaczen
I put a break point in the call right above (apply #'make-instance metaclass :name name initargs)
7:12:34
emaczen
The problem is the metaclass argument in ensure-class-using class is a standard-class with the name of my metaclass
7:18:04
emaczen
Before, after I tried what I thought, then I tried make-instance like you originally said haha