On Wed, May 21, 2014 at 3:45 AM, <joerg-cyril.hoe...@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
>
_______________________________________________
Iterate-devel mailing list
Iterate-devel@common-lisp.net
http://common-lisp.net/cgi-bin/mailman/listinfo/iterate-devel

Reply via email to