Hi, I have difficulty reading some lisp source code.
What is the (let (var1 var2 var3) ....) means?
I looks like to initialize each variables to nil, but I couldn't find any
lisp reference for (let (var1 var2 var3) ...).
All I found was let ({var | (var value)}*) {declaration}* {form}*.
Thanks in advance.
In article <····················@vixen.cso.uiuc.edu>,
Young-Jin Lee <······@uiuc.edu> wrote:
>Hi, I have difficulty reading some lisp source code.
>What is the (let (var1 var2 var3) ....) means?
>I looks like to initialize each variables to nil, but I couldn't find any
>lisp reference for (let (var1 var2 var3) ...).
>All I found was let ({var | (var value)}*) {declaration}* {form}*.
It's right there in the syntax that you quoted. {var | (var value)}* means
a sequence of either "var" or "(var value)". In your example, they all
match the "var" option.
--
Barry Margolin, ······@genuity.net
Genuity, Burlington, MA
*** DON'T SEND TECHNICAL QUESTIONS DIRECTLY TO ME, post them to newsgroups.
Please DON'T copy followups to me -- I'll assume it wasn't posted to the group.
Barry Margolin <······@genuity.net> writes:
> In article <····················@vixen.cso.uiuc.edu>,
> Young-Jin Lee <······@uiuc.edu> wrote:
> >Hi, I have difficulty reading some lisp source code.
> >What is the (let (var1 var2 var3) ....) means?
> >I looks like to initialize each variables to nil, but I couldn't find any
> >lisp reference for (let (var1 var2 var3) ...).
> >All I found was let ({var | (var value)}*) {declaration}* {form}*.
>
> It's right there in the syntax that you quoted. {var | (var value)}* means
> a sequence of either "var" or "(var value)". In your example, they all
> match the "var" option.
But stylistically, I and many others recommend you use
(LET ((X NIL)) ...)
to initialize X to NIL, but use
(LET (X) ...)
to say "I plan to initialize this later, e.g., by a SETQ."
Of course, it is well-defined what it will hold if not initialized,
but it's a nice visual distinction to make anyway.
more info regarding let is at:
http://www.cs.cmu.edu/Groups/AI/html/cltl/clm/node83.html
use 'let' for local variables and 'setf' for global variables
--
Kee Dae Nam
····@home.com
Knowledge is power -- Francis Bacon
"Young-Jin Lee" <······@uiuc.edu> wrote in message
·························@vixen.cso.uiuc.edu...
> Hi, I have difficulty reading some lisp source code.
> What is the (let (var1 var2 var3) ....) means?
> I looks like to initialize each variables to nil, but I couldn't find any
> lisp reference for (let (var1 var2 var3) ...).
> All I found was let ({var | (var value)}*) {declaration}* {form}*.
>
> Thanks in advance.
>
>