In a loop I sometimes use "as y = x then y" to have a similar
effect to "with y = x" but to have it executed after x is
calculated during the first iteration.
E.g.
(loop as x in '(1 2 3)
as y = x then y
do (print (list x y)))
(1 1)
(2 1)
(3 1)
NIL
vs
(loop as x in '(1 2 3)
with y = x
do (print (list x y)))
(1 NIL)
(2 NIL)
(3 NIL)
NIL
My question is whether "as y = x then y" is the canonical
idiom for this, or whether I'm overlooking a better way to
express the same thing.
Hi
"Eric Smith" <········@yahoo.com> skrev i en meddelelse
·································@posting.google.com...
> My question is whether "as y = x then y" is the canonical
> idiom for this, or whether I'm overlooking a better way to
> express the same thing.
Mapcar and Apply.
P.C.
········@yahoo.com (Eric Smith) writes:
> My question is whether "as y = x then y" is the canonical
> idiom for this, or whether I'm overlooking a better way to
> express the same thing.
It looks o.k. to me (except that I prefer to use 'for', but that's
a matter of taste).
--
(espen)