The value accumulation clauses, on the other hand, provide a concise notation for a handful of common loop idioms having to do with accumulating values while looping. Each accumulation clause starts with a verb and follows this pattern:
The possible verbs are collect
, append
, nconc
, count
, , maximize
, and minimize
. Also available as synonyms are the present participle forms: collecting
, appending
, nconcing
, counting
, summing
, maximizing
, and minimizing
.
The remaining accumulation clauses are used to accumulate numeric values. The verb count
counts the number of times form is true, sum
collects a running total of the values of form, maximize
collects the largest value seen for form, and minimize
collects the smallest. For instance, suppose you define a variable *random*
that contains a list of random numbers.