Path: utzoo!utgpu!news-server.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!zaphod.mps.ohio-state.edu!brutus.cs.uiuc.edu!psuvax1!rutgers!bellcore!pyuxp!pyuxe!nvuxl!nvuxh!hall From: hall@nvuxh.uucp (25575-Michael R Hall(2498)m000) Newsgroups: comp.lang.lisp Subject: Re: Interesting Evaluation? Message-ID: <323@nvuxl.UUCP> Date: 22 Mar 90 19:54:58 GMT References: <18663@boulder.Colorado.EDU> Sender: netnews@nvuxl.UUCP Distribution: usa Lines: 31 In article <18663@boulder.Colorado.EDU>, schiff@boulder.Colorado.EDU (SCHIFF DAVID) writes: > I am just learning common lisp and came across a deceptively simple > looking piece of code, which gave quite a surprising result. I believe > I have figured out why but am wondering what an experienced programmer's > explanation would be. > > (setf a 'global) > (let ((a 'local)) (eval 'a)) > > The result of evaluating the second expression is *of course* "GLOBAL":-) I think I had this question on a final once. From Steele's Comm Lisp ed. 1, section 20.1, page 321, "eval *form* [Function] The *form* is evaluated in the current dynamic environment and a NULL LEXICAL ENVIRONMENT." It goes on to talk about the two levels of evaluation that occur. What would the following evaluate to? (defvar a 'global) (let ((a 'local)) (eval 'a)) Answer ahead LOCAL, of course. Michael R. Hall |"We have seen pictures [of Mars] where there are hall@nvuxh.cc.bellcore.COM |canals, we believe, and water. If there is water, rutgers!bellcore!nvuxh!hall|there is oxygen. If oxygen...we can breathe."-Quayle