Greetings!  Sorry I did not see this earlier.  In case this is still
extant:

daly <d...@axiom-developer.org> writes:

> Camm,
>
> I am seeing some odd behavior in loops.
>
> If I write
>
> (let (result)
>   (setq a 
>     (do ((x somelist (cdr x)) (result nil))
>         ((atom x) (reverse result))
>       (setq result (cons (fn x) result)))))

This passes each cons of somelist to fn, not just the cars.  The outer
result binding is shadowed by the equivalent binding in the do.

>
> or, in a simple form as
> (let (result)
>   (setq a
>    (dolist (x somelist (nreverse result))
>      (setq result (cons (fn x) result)))))
>

This passes the each car of somelist to fn, and will give different
results thereby.

> I do not get the same behavior as
> (setq a 
>  (prog ()
>   (return
>    (do ((x somelist (cdr x)) (result nil))
>        ((atom x) (reverse result))
>     (setq result (cons (fn x) result))))))
>

This is equivalent to the first.

Please let me know if this does not clear this up, and/or if you find
different behavior w.r.t. any other lisp.

Take care,
-- 
Camm Maguire                                        c...@maguirefamily.org
==========================================================================
"The earth is but one country, and mankind its citizens."  --  Baha'u'llah

_______________________________________________
Axiom-developer mailing list
Axiom-developer@nongnu.org
https://lists.nongnu.org/mailman/listinfo/axiom-developer

Reply via email to