LET*

binding of lexically scoped (local) variables
Major Section:  PROGRAMMING

Example LET* Forms:
(let* ((x (* x x))
       (y (* 2 x)))
 (list x y))

(let* ((x (* x x)) (y (* 2 x)) (x (* x y)) (a (* x x))) (declare (ignore a)) (list x y))

If the forms above are executed in an environment in which x has the value -2, then the respective results are '(4 8) and '(32 8). See let for a discussion of both let and let*, or read on for a briefer discussion.

The difference between let and let* is that the former binds its local variables in parallel while the latter binds them sequentially. Thus, in let*, the term evaluated to produce the local value of one of the locally bound variables is permitted to reference any locally bound variable occurring earlier in the binding list and the value so obtained is the newly computed local value of that variable. See let.

In ACL2 the only declare forms allowed for a let* form are ignore and ignorable. See declare. Moreover, no variable declared ignored or ignorable may be bound twice (or more).

Let* is a Common Lisp macro. See any Common Lisp documentation for more information.