Go to the previous, next section.
These clauses cause the loop to accumulate information about the
specified Lisp form. The accumulated result is returned
from the loop unless overridden, say, by a return
clause.
collect form
collect
appear elsewhere in this manual.
The word collecting
is a synonym for collect
, and
likewise for the other accumulation clauses.
append form
append
.
nconc form
concat form
vconcat form
count form
nil
value.
sum form
maximize form
maximize
is executed zero times.
minimize form
Accumulation clauses can be followed by `into var' to
cause the data to be collected into variable var (which is
automatically let
-bound during the loop) rather than an
unnamed temporary variable. Also, into
accumulations do
not automatically imply a return value. The loop must use some
explicit mechanism, such as finally return
, to return
the accumulated result.
It is legal for several accumulation clauses of the same type to accumulate into the same place. From Steele:
(loop for name in '(fred sue alice joe june) for kids in '((bob ken) () () (kris sunshine) ()) collect name append kids) => (fred bob ken sue alice joe kris sunshine june)
Go to the previous, next section.