I am having some difficulty understanding the behavior of the following:
(let ((*my-print-length* 10))
(defun foo ()
(let ((*print-length* *my-print-length*))
(print *print-length*)
t)))
(let ((*print-length* 10)
(*my-print-length* 8))
(defun bar ()
(print *print-length*)
(print *my-print-length*)
t))
Assuming *print-length* is NIL at the top level. Within #'foo
*print-length* is 10 (inside the let of course). Within #'bar
*print-length* is NIL. I expected *print-length* to be 10 inside both.
Could someone explain why this happens? Thank you.
Side note: This started as trying to have a special readtable that
affected only one function. Wrapping a defun with a let seemed like
a slicker way to accomplish that than binding *readtable* to a global
*my-readtable* within the function (ala #'foo). After investigation
I noticed that any LISP special variable I tried showed the same
property as exhibited above by *print-length*.
Once again thanks a lot for your help.
Hope you have a very nice day. :-)
Judi Achtenberg Ayers e-mail: ······@seq.hamline.edu
Hamline University St. Paul, MN USA