[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: dolist
- To: clisp-list <clisp-list@ma2s2.mathematik.uni-karlsruhe.de>
- Subject: Re: dolist
- From: Steve Haflich <smh@Franz.COM>
- Date: Sun, 28 Apr 1996 10:06:59 -0700
- In-reply-to: Your message of "Sun, 28 Apr 1996 18:16:25 +0200." <9604281547.AA22037@hershey.harvard.edu>
From: pg@das.harvard.edu
I agree in that this code
(let ((x 1))
(let ((f #'(lambda () x)))
(setq x 2)
(funcall f)))
should return 2. The question is, should dolist be understood as
creating one variable (as it would if it expanded into a tagbody
with a setq) or a different variable on each iteration (as it would
if it expanded into a recursive function). I believe that the
standard is vague here...
If by "the standard" you meand the ANSI Standard for CL, then it is
not at all vague. The dictionary entry for DOLIST in Chapter 6 says:
It is implementation-dependent whether DOLIST establishes a new
binding of VAR on each iteration or whether it establishes a binding
for VAR once at the beginning and then assigns it on any subsequent
iterations.
This is hardly vague. Rather, portable code is prohibited from
depending on this detail of behavior. Implementations may vary, and
even a single implementation is allowed to handle it in different ways
in differeent circumstances.
- Follow-Ups:
- Re: dolist
- From: Marcus Daniels <marcus@sysc.pdx.edu>