I am newbie at programming in lisp.I am using sbcl.In one part of program thread is created as-
(sb-thread:make-thread
(lambda ()
(progn
(sleep 0)
(setf c (+ a b))
(print "ADDITION:")
(print c))))
I am not getting what lambda() and progn(sleep 0) does, and why it is written inside sb-thread bracket?
sb-thread:make-thread takes a function to call in a newly created thread.
(lambda ()
(progn
(sleep 0)
(setf c (+ a b))
(print "ADDITION")
(print c)))
is an anonymous function. In turn progn creates a program block (un-necessarily in this case, as a lambda body is an implicit progn) and (sleep 0) is probably used as a "please invoke the scheduler here" (it's essentially a no-op, sleeping for 0 seconds).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With