77 lines
2.4 KiB
HTML
77 lines
2.4 KiB
HTML
<!DOCTYPE HTML PUBLIC "-//W3O//DTD W3 HTML 2.0//EN">
|
|
<!Originally converted to HTML using LaTeX2HTML 95 (Thu Jan 19 1995) by Nikos Drakos (nikos@cbl.leeds.ac.uk), CBLU, University of Leeds >
|
|
<HEAD>
|
|
<TITLE> let (SPECIAL FORM)</TITLE>
|
|
</HEAD>
|
|
<BODY>
|
|
<meta name="description" value=" let (SPECIAL FORM)">
|
|
<meta name="keywords" value="lp">
|
|
<meta name="resource-type" value="document">
|
|
<meta name="distribution" value="global">
|
|
<P>
|
|
<BR> <HR>
|
|
<A HREF="node99.html"><IMG ALIGN=BOTTOM ALT="next" SRC="next_motif.gif"></A>
|
|
<A HREF="node72.html"><IMG ALIGN=BOTTOM ALT="up" SRC="up_motif.gif"></A>
|
|
<A HREF="node97.html"><IMG ALIGN=BOTTOM ALT="previous" SRC="previous_motif.gif"></A> <BR>
|
|
<A HREF="lp.html"><B>Contents</B></A>
|
|
<B> Next:</B>
|
|
<A HREF="node99.html"> list (FUNCTION)</A>
|
|
<B>Up:</B>
|
|
<A HREF="node72.html"> Appendix: Selected Lisp </A>
|
|
<B> Previous:</B>
|
|
<A HREF="node97.html"> length (FUNCTION)</A>
|
|
<BR> <HR> <P>
|
|
<H1> let (SPECIAL FORM)</H1>
|
|
<P>
|
|
<b> Format:</b>
|
|
<tt> (let ((<var1> <init1> )</tt>
|
|
<tt> (<var2> <init2> )</tt>
|
|
<tt> .</tt>
|
|
<tt> .</tt>
|
|
<tt> (<varN> <initN> ))</tt>
|
|
<tt> <body> )</tt>
|
|
<P>
|
|
<b> Required arguments:</b>
|
|
1
|
|
<P>
|
|
<tt> ((<var> <init> )...)</tt>: a list of zero or more lists having the
|
|
form <tt> (<var> )</tt> or <tt> (<var> <init> )</tt>. <tt> <var> </tt> must be a
|
|
symbol appropriate as the name of a variable. <tt> <init> </tt> may be
|
|
any Lisp expression.
|
|
<P>
|
|
<b> Optional arguments:</b>
|
|
arbitrary
|
|
<P>
|
|
<tt> <body> </tt>: any sequence of zero or more Lisp expressions.
|
|
<P>
|
|
The <tt> <var> </tt>'s are established as local variables for the
|
|
expressions in <tt> <body> </tt>. If a <tt> <var> </tt> is not accompanied by an
|
|
<tt><init> </tt> expression, it is initially bound to NIL. Otherwise, <tt> <init> </tt>
|
|
is evaluated and assigned as the value of <tt> <var> </tt>. let evaluates
|
|
all the expressions in <tt> <body> </tt> and returns the value of the last, or
|
|
NIL if there are none.
|
|
<P>
|
|
<b> Examples:</b>
|
|
<P>
|
|
<BLOCKQUOTE>
|
|
<PRE>> (let ((a)
|
|
(b))
|
|
(and (not a) (not b)))
|
|
T
|
|
|
|
> (let ((a 3)
|
|
(b 4))
|
|
(setf a (+ a b))
|
|
(setf b (+ a b))
|
|
(+ a b))
|
|
18
|
|
</PRE>
|
|
</BLOCKQUOTE>
|
|
<P>
|
|
<BR> <HR>
|
|
<P>
|
|
<ADDRESS>
|
|
<I>© Colin Allen & Maneesh Dhagat <BR>
|
|
March 2007 </I>
|
|
</ADDRESS>
|
|
</BODY>
|