[iterate-devel] Sequence variables are initialized twice

Kilian Sprotte ml13 at onlinehome.de
Mon Jun 18 17:05:51 UTC 2007


Hi,

although I might become an iterate developer one day, I dont really  
feel yet in the position to comment on the possible problems.
I just wanted to add that yesterday, I was stumbling about exactly  
the same problematic.

If there is some code to be tested etc I would be interested.

Cheers,
   Kilian

Am 14.06.2007 um 14:24 schrieb Bruno Daniel:

> Dear developers,
>
> the following example shows that iter initializes
> sequence variables twice, once with 0 and once with
> the start of the range minus 1.
>
> (macroexpand-1 '(iter (for i below 10)
>                     (print i)))
> -->
> (LET* ((I 0))
>  (DECLARE (TYPE NUMBER I))
>  (BLOCK NIL
>    (TAGBODY
>      (SETQ I -1)
>     LOOP-TOP-NIL
>      (SETQ I (+ I 1))
>      (IF (>= I 10) (GO LOOP-END-NIL))
>      (PRINT I)
>      (GO LOOP-TOP-NIL)
>     LOOP-END-NIL)
>    NIL))
>
> The problem with this is not that this is a little bit
> ugly but that one must allow negative values in declarations
> for the driver variable, which conflicts with (unsigned-byte 32)
> declarations.
>
> Could I write a new driver instead of for that fixes the
> problem or will I run into trouble because someteimes one of the
> initial values is needed for something else (the else clause,
> first-time-p or initially?).
>
> Moreover, the declaration is not very tight. dotimes does better
> on SBCL:
>
> (macroexpand-1 '(dotimes (i 10)
>                     (print i)))
> -->
> (DO ((I 0 (1+ I)))
>    ((>= I 10) NIL)
>    (DECLARE (TYPE UNSIGNED-BYTE I))
>    (PRINT I))
>
> Best regards
>  Bruno Daniel
>
> _______________________________________________
> iterate-devel site list
> iterate-devel at common-lisp.net
> http://common-lisp.net/mailman/listinfo/iterate-devel




More information about the iterate-devel mailing list