4 ms·
SERIES is indeed quite a different approach. A more Lisp-idiomatic approach to iteration, though not so far from LOOP, is ITERATE. http://www.common-lisp.net/
by nemoniac 12y ago
SERIES is indeed quite a different approach.
A more Lisp-idiomatic approach to iteration, though not so far from LOOP, is ITERATE.
http://www.common-lisp.net/project/iterate/doc/Don_0027t-Loop-Iterate.html http://www.common-lisp.net/project/iterate/doc/Don_0027t-Loo...
- lispm 12y agoThe main thing which makes ITERATE more idiomatic in Lisp from a syntactic point of view is this: ITERATE groups clauses as sublists. Other than that the ITERATE approach is very similar to LOOP. (iterate (for el in num-list) (when (> el 3) (collect el))) vs. (loop for el in num-list when (> el 3) collect el) As you can see from the above example, ITERATE has more parentheses... which from a Lisp point of view makes sense. But for this typical iteration example it looks almost the same, otherwise. ITERATE has also quite some more capabilities than LOOP, for example it supports accumulation of results from nested loops.