2 Loop Constructs

2.4 Value accumulation

Accumulating values during iteration and returning them from a loop is often useful. Some of these accumulations occur so frequently that special loop clauses have been developed to handle them.

The following loop keywords designate clauses that accumulate values in lists and return them:

append, appending 
collect, collecting
nconc, nconcing 

The following loop keywords designate clauses that accumulate and return numerical values:

count, counting
maximize, maximizing
minimize, minimizing
sum, summing 

The loop prepositioninto can be used to name the variable used to hold partial accumulations. The variable is bound as if by the loop constructwith. See Section 2.5 on page 30 for more information aboutwith. Ifinto is used, the construct does not provide a default return value; however, the variable is available for use in anyfinally clause.

Note: These loop keywords can also be spelled with the optional suffixing.

2.4.1 - Combining accumulation clauses
2.4.2 - Reference pages

The Loop Facility - 9 SEP 1996

Generated with Harlequin WebMaker