[Iterate-devel] iterate on list bug?

Gábor Balázs gabalz at gmail.com
Wed May 21 15:33:15 UTC 2014


On Wed, May 21, 2014 at 3:45 AM, <Joerg-Cyril.Hoehle at t-systems.com> wrote:

> Gábor Balázs wrote:
>
> >The bold lines should appear in reverse order, I think.
> >       (IF (ATOM #:LIST214)
> >           (GO LOOP-END-NIL))
> >       (SETQ VAR #:LIST214)
> You can't invert the order, because that would be a type violation.
> Iterate may make use of types, see *declare-variables*.
>
> Furthermore, the spec does not guarantee that value after the end of the
> iteration.
> Quite to the contrary, it's explicitly disallowed. Quote:
>
> "In all cases, the value of the driver variable on exit from the loop,
> including within the epilogue code (see the finally clause), is
> undefined."
>

This is indeed a surprise for me.
Definitely should be on the "Differences between LOOP and iterate" page.

But I think iterate should make the drivers accessible in the epilogue.
This code is not that nice and confusing.

(iter (for var on mylist)
      (for var2 = (rest var))
      (collect (car var) into result)
      (finally (return (values result var2))))
(:ONE :TWO :THREE)
NIL

So is there some design reason against making the drivers accessible in the
finally clause?
Maybe, could just iterate parse the finally clause and make the proper
adjustments if necessary?

`bg`


> Regards,
>         Jörg Höhle
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/iterate-devel/attachments/20140521/cbc9054f/attachment.html>


More information about the iterate-devel mailing list