Next: , Previous: Variable Binding and Setting, Up: Clauses


2.3 Gathering Clauses

Many of iterate's clauses accumulate values into a variable, or set a variable under certain conditions. At the end of the loop, this variable contains the desired result. All these clauses have an optional into keyword, whose argument should be a symbol. If the into keyword is not supplied, the accumulation variable will be internally generated and its value will be returned at the end of the loop; if a variable is specified, that variable is used for the accumulation, and is not returned as a result—it is up to the user to return it explicitly, in the loop's epilogue code (see finally). It is safe to examine the accumulation variable during the loop, but it should not be modified.

These clauses all begin with a verb. When the verb does not conflict with an existing Common Lisp function, then it may be used in either its infinitival or present-participle form (e.g. sum, summing). However, when there is a conflict with Common Lisp, only the present-participle form may be used (e.g. unioning). This is to prevent iterate clauses from clashing with Common Lisp functions.