An iteration-driving clause conceptually causes the iteration to go
forward. Driver clauses in
iterate allow iteration over numbers,
lists, vectors, hashtables, packages, files and streams.
Iteration-driving clauses must appear at the top level of an
form; they cannot be nested inside another clause. The driver
variable is updated at the point where the driver clause occurs.
Before the clause is executed for the first time, the value of the
variable is undefined.
Multiple drivers may appear in a single
iterate form, in which case all
of the driver variables are updated each time through the loop, in the
order in which the clauses appear. The first driver to terminate will
terminate the entire loop.
In all cases, the value of the driver variable on exit from the loop,
including within the epilogue code (see the
finally clause), is
All the parameters of a driver clause are evaluated once, before the loop begins. Hence it is not possible to change the bounds or other properties of an iteration by side-effect from within the loop.
With one exception, driver clauses begin with the word
as) and mention an iteration variable, which is
given a binding within the
iterate form. The exception is
repeat, which just executes a loop a specified number of times: