[Openmcl-devel] Capturing the lexical value for a special variable

David L. Rager ragerdl at cs.utexas.edu
Tue Nov 30 17:38:19 PST 2010


Hello CCL-Devel,

Is there a way to force a lambda to capture the lexical value for a
special variable?  I'd like the following to print "7" instead of "0":

(defvar *v* 0)

(defun bar ()
 (let ((*v* 7))
   (ccl:process-run-function
    "test thread"
    (lambda () (let ((*v* *v*))
                 (print *v*))))))

(bar)

I could write a macro that looked a lot like a lambda, except it
substituted the lexical value of *v* for "*v*" in the let binding
(probably by using eval).  But, I was wondering if there is something
less kludgy.

Thanks,
David



More information about the Openmcl-devel mailing list