On Tue, Nov 30, 2010 at 5:38 PM, David L. Rager <span dir="ltr"><<a href="mailto:ragerdl@cs.utexas.edu">ragerdl@cs.utexas.edu</a>></span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hello CCL-Devel,<br>
<br>
Is there a way to force a lambda to capture the lexical value for a<br>
special variable? I'd like the following to print "7" instead of "0":<br>
<br>
(defvar *v* 0)<br>
<br>
(defun bar ()<br>
(let ((*v* 7))<br>
(ccl:process-run-function<br>
"test thread"<br>
(lambda () (let ((*v* *v*))<br>
(print *v*))))))<br></blockquote><div><br>A special variable doesn't have a lexical value. Why not just do this?<br><br>(defun bar ()<br>
(let* ((*v* 7)<br> (v *v*))<br>
(ccl:process-run-function<br>
"test thread"<br>
(lambda () (let ((*v* v))<br>
(print *v*))))))<br>
<br>This is assuming you have some reason to want *v* to be bound in the thread.<br><br>-- Scott<br><br></div></div>