Next: Rolling Your Own, Previous: Problems with Code Movement, Up: Top
Iterate and Looploop contains a great deal of complexity which iterate tries to
avoid. Hence many esoteric features of loop don't exist in
iterate. Other features have been carried over, but in a cleaned-up
form. And of course, many new features have been added; they are not
mentioned in this list.
iterate's syntax is more Lisp-like than loop's, having a higher
density of parens.
iterate, unlike the current version of
loop (as documented in Common Lisp, 2nd Ed.), is
extensible (see Rolling Your Own).
loop puts the updates of all driver variables at the top of the
loop; iterate leaves them where the driver clauses appear.
iterate clauses that resemble loop
clauses behave similarly, there are some differences. For instance,
there is no for... =... then in iterate; instead use
for... initially... then.
loop binds the variable it at certain times to allow
pseudo-English expressions like when expr return it. In
iterate, you must bind expr to a variable yourself. Note that
when expr return it is like thereis expr
except that the latter is an accumulation clause and therefore
competes with other accumulations (remember “Multiple Accumulations”
in Other Features).
loop has a special return clause, illustrated in the
previous item. iterate doesn't need one, since an ordinary Lisp
return has the same effect.
loop allows for parallel binding and stepping of iteration
variables. iterate does not. (See Parallel Binding and Stepping.)
loop and iterate handle variable type declarations very
differently. loop provides a special syntax for declaring
variable types, and does not examine declarations. Moreover, the
standard implementation of loop will generate declarations when
none are requested. iterate parses standard Common Lisp type
declarations, and will never declare a variable itself unless
declarations are specifically requested.