loop 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).
loopputs the updates of all driver variables at the top of the loop;
iterateleaves them where the driver clauses appear.
iterateclauses that resemble
loopclauses behave similarly, there are some differences. For instance, there is no
for... =... thenin
iterate; instead use
for... initially... then.
loopbinds the variable
itat certain times to allow pseudo-English expressions like
return it. In
iterate, you must bind expr to a variable yourself. Note that
return itis like
thereisexpr except that the latter is an accumulation clause and therefore competes with other accumulations (remember “Multiple Accumulations” in Other Features).
loophas a special
returnclause, illustrated in the previous item.
iteratedoesn't need one, since an ordinary Lisp
returnhas the same effect.
loopallows for parallel binding and stepping of iteration variables.
iteratedoes not. (See Parallel Binding and Stepping.)
iteratehandle variable type declarations very differently.
loopprovides a special syntax for declaring variable types, and does not examine declarations. Moreover, the standard implementation of
loopwill generate declarations when none are requested.
iterateparses standard Common Lisp type declarations, and will never declare a variable itself unless declarations are specifically requested.