freenode/#lisp - IRC Chatlog
Search
7:47:11
earl-ducaine
I'm revisiting my knowlege of eval-when. My rule-of-thumb is: use it when you have a macro that's dependant on a function that's defined in the same file. Is that a reasonable summary? Any other considerations that should be raised to the level of rule-of-thumb?
7:48:04
beach
If you have an initial value of a variable that is required at compilation time later in the same file.
7:51:45
phoe
earl-ducaine: you have (defun foo () 2) (defmacro bar () (foo)) in the same file - this is going to fail, most likely
7:53:14
earl-ducaine
Oh, and a style question. How bad of form is to always use the full set of situations (:load-toplevel :compile-toplevel :execute) even one one's not needed...
7:55:56
phoe
you should not need to use other combinations unless you're meddling with the Lisp compiler or seriously play with how Lisp compiles files in general.
8:17:51
earl-ducaine
No meddling in the dark arts tonight. Learned my lesson with the pail and broom. Thanks for the help!
12:31:36
Thetabit_
I'm having some trouble with Emacs + Slime + SBCL. I have a fairly bare bones setup because I have to do my development on a windows box. But SBCL keeps crashing and locking Emacs up. I don't experience the crashing in a linux environment so I am wondering if Emacs + SBCL + Slime are the best when working in Windows. What do you guys think?
13:29:32
thetabit
I'm reading PCL and going thru the function section. I am trying to 'call' each function in a list which using a loop, instead I am looking to (apply #'funcall (list fn1 fn2 fn3)) but this does not seem to work. What am I missing
13:31:36
phoe
(defun fn1 () (print "hello")) (defun fn2 () (print "allo")) (defun fn3 () (print "hola")) (apply #'funcall (list #'fn1 #'fn2 #'fn3))
13:43:52
phoe
and in the inner list, you have a plist, and you want to iterate over a set of plist key/value pairs, correct?
16:50:13
slark
Hello, i learnt how to create closures in the gigamonkeys tutorial, but i am not sure how and why to use them.
16:50:52
beach
slark: Suppose you want, for a given X, find the first element in a list that is greater than X.
16:51:26
beach
slark: You could do (defun find-greater (x list) (find-if (lambda (y) (> y x)) list))
16:54:08
slark
beach: yeah sorry.. i mean when i am designing code, in general, where should i use closure ?
16:59:27
nosefouratyou_
wow I completely don't understand (defun find-greater (x list) (find-if (lambda (y) (> y x)) list))
17:00:51
Bike
find-if finds the first element of list that satisfies the predicate (lambda (y) (> y x))
17:01:39
nosefouratyou_
because initially x is a number, but the inner find-if call passes a function as x, right?
17:03:20
nosefouratyou_
Bike: my bad, I thought find-greater/find-if were the same function. I was misreading it.
17:15:25
slark
in the chapter 6 in gigamonkeys tutorial there is this footnote: http://paste.lisp.org/display/350852
17:16:52
slark
what does it mean? does it mean we can use dynamic bindings in multithreaded application without problem ?
17:17:58
kang0
Which books in computer science or coding field; one must have /recommended to have in hard copy or printed form instead of ebooks
17:20:31
slark
knusbaum: so i will not have to mess up with "lock" and kind of stuff if my threads have access to this *stream-output* if i use dynamic bindings ?
17:21:37
knusbaum
If multiple threads are accessing the same object, you still have to synchronize that access.
17:23:50
knusbaum
slark: This is what the footnote was talking about: http://paste.lisp.org/display/350854
17:23:56
slark
knusbaum: dynamic binding is kind of global variable shadowing with the same name as the global variable
17:28:08
slark
knusbaum: ok so the second thread take the variable as global cause the dynamic binding is related to the 1st thread
17:48:27
beach
slark: Dinner, not lunch. But, what Bike said. Closures don't play a great strategic role in Common Lisp. They are used for tactical reasons in situations like I showed.
17:53:20
beach
slark: The book SICP (based on Scheme) uses closures strategically, because they allow encapsulation of state. But Common Lisp has CLOS, with its classes and generic functions (which is more flexible and more powerful), so we don't use closures that way.
17:58:09
kang0
Which programs or softwares needs to be installed in computer while reading or trying book sicp
18:04:26
slark
kang0: but in scip they use scheme, so if you are a bit familliar with lisp in general it should be OK to work with common lisp while reading scip