On Sun, 12 Jun 2005 18:40:48 +0100, <[EMAIL PROTECTED]> wrote: > GP lisper <[EMAIL PROTECTED]> writes: >> On Sun, 12 Jun 2005 12:30:01 +0300 (EEST), <[EMAIL PROTECTED]> wrote: >>> On Sun, 12 Jun 2005, Nicolas Neuss wrote: >>> >>>>>>> (loop with m = 5 >>>>>>> initially (setq m 3) >>>>>>> for i below m do (princ i)) >>>>>>> >>>>>>> should print only "012", no? >> >> After reading 6.1.1.6, I say "no" still. The progn for the prologue is: >> (setq m 3) >> >> and then 'm' is set to 5 every pass thru the loop. >> >> On the other hand, I keep wondering what you see that I miss... > > From the page which you said you read: > > A with clause introduces a variable binding and an optional initial > value. The initial values are calculated in the order in which the > with clauses occur. > > Things which "with" clauses do not do include any kind of stepping or > setting at each iteration round the loop.
(loop with m = 5 initially (setq m 0) for i below m do (princ i)) ==> 01234 But (loop with m = 5 initially (setq m 0) for i below m do (princ m)) ==> 00000 Which matches your reply. So the clause "for i below m do (princ m)" is translated to "for i below 5 do (princ m)" before the loop prologue is run. That follows "All variables are initialized first, regardless of where the establishing clauses appear in the source." (JonL CLtL2 26.3.1) Thanks! I think...depends if I get run over in the next c.l.l. LOOP thread. Or more likely, how bad I get run over.... -- The LOOP construct is really neat, it's got lots of knobs to turn! Don't push the yellow one on the bottom.