Hi again,

Albert Krewinkel wrote:
>> (for e in-matrix foo with-indices (i j))
>That sure is a good way to do this.  Maybe you are right, and the
>python zen "explizit is better than implicit" applies to this
>situation as well. But I just feel like it's more verbose than
>necessary.

To me it seems like "Iterate zen".  Otherwise you are with things like
Series.  Actually, naming things simplifies (or make possible) some
complex loops.

>  (iter (for el in-vector v with-index i)
>        (setf (aref v i) 1))
>the expansion code will contain (setq el (aref...)).
The Iterate zen is for i index-of-vector.  See manual.
That would not invoke aref.

The careful reader of the manual might expect
(for nil in-vector ... with-index i) to avoid aref given a clever
implementation, however Iterate is not Loop, so that construct does not
work (yet?) with Iterate.

BTW, do users consider this a bug?
(iter (for nil in-vector "abc") (counting t)) => error
(loop for nil across "abc" count t) => 3
(loop for nil in '(1 2 3) count t) => 3 etc.

However
(iter (for nil in-package "CL" :external-only t) (counting t)) => 978
probably as a hazard of the implementation.

>It's a quick hack and for testing only
>    (ecase row-or-column
>      ((or column col)
>      ('row
Your code may appear to work for you, but your case expression is subtly
broken.
Please try
(for el in-vector v by OR)
(for el in-vector v by QUOTE)

Regards,
        Jorg Hohle.
_______________________________________________
iterate-devel site list
iterate-devel@common-lisp.net
http://common-lisp.net/mailman/listinfo/iterate-devel

Reply via email to