Major Section: PROGRAMMING
Example LET* Forms: (let* ((x (* x x)) (y (* 2 x))) (list x y))If the forms above are executed in an environment in which(let* ((x (* x x)) (y (* 2 x)) (x (* x y)) (a (* x x))) (declare (ignore a)) (list x y))
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 at most one declare
form may be specified for a let*
form,
in which case it must be of the form (declare (ignore v1 ... vk))
where
v1
through vk
are symbols.
Let*
is a Common Lisp macro. See any Common Lisp
documentation for more information.