From: Bill Hogan
Subject: Re: Let/eval question
Date: 
Message-ID: <750657137.1@wyrm.rbbs-net.ORG>
 DS> From: ···@seaman.cc.purdue.edu (Dave Seaman)
 DS> Path: 
 DS> myrddin!lll-winken.llnl.gov!sol.ctr.columbia.edu!howland.reston.
 DS> ans.net!usenet.ins.cwru.edu!lerc.nasa.gov!purdue!mentor.cc.purdu
 DS> e.edu!news Newsgroups: comp.lang.lisp Subject: Re: Let/eval 
 DS> question Organization: Purdue University
 DS> Message-ID: <··········@mentor.cc.purdue.edu>
 DS> References: <···········@wyrm.rbbs-net.ORG>
 DS> Date: Thu, 14 Oct 1993 19:05:34 GMT
     
 DS> In article <···········@wyrm.rbbs-net.ORG>
 DS> ··········@f201.n914.z8.rbbs-net.ORG (Bill Hogan) writes:
>> Marshall,
>>   My first response was, well what he has in mind is
>>   (let ((a 1)) (eval a)), which is 1, but I would have expected the
>>   value of (let ((anything whatever)) (eval (quote this))) to be `this'.
>>   I was surprised to get an error (undefined symbol: this), as if I had
>>   written (let ((anything whatever)) (eval this)), in which case I would
>>   have expected to get the error (undefined symbol: this)! I don't see
>>   the rationale.
>> Bill

 DS> Try this: (let ((anything whatever)) (eval '(+ 3 4)))

 DS> The result is 7. As with any ordinary lisp function, EVAL
                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 DS> receives its argument(s) already evaluated. In other words,
     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 DS> EVAL sees the expression (+ 3 4) (the quote was removed already
 DS> before EVAL even saw the argument). What does EVAL do with its
 DS> argument? It evaluates it (again), thus obtaining 7. Look again
 DS> at what you wrote, and compare it with

 DS> (let ((anything whatever)) (eval ''this))

 DS> which has two quotes before THIS. That's what you need to avoid
 DS> the undefined symbol error, if you insist on using EVAL in this
 DS> context.

Thank you, Dave (and Joshua), that makes perfect sense to me. What I did
not know is underlined above. (eval (quote this)) tries to evaluate `this',
which I have not defined. [You there Marshall?] <Bill

 Thank you.

BILL HOGAN



 * Origin: PCUG BBS - San Francisco HST/V.32 415-621-2609 (8:914/201.0)