Common Lisp the Language, 2nd Edition
Next: General Iteration
Up: Iteration
Previous: Iteration
The loop
construct is the simplest iteration facility.
It controls no variables, and simply executes its body repeatedly.
[Macro]
loop
{
form
}*
Each form is evaluated in turn from left to right. When the
last form has been evaluated, then the first form is
evaluated again, and so on, in a never-ending cycle. The
loop
construct never returns a value. Its execution must be
terminated explicitly, using return
or throw
,
for example.
loop
, like most iteration constructs, establishes an
implicit block named nil
. Thus return
may be
used to exit from a loop
with specified results.
A loop
construct has this meaning only if every
form is non-atomic (a list). The case where some form
is atomic is reserved for future extensions.
Implementation note: There have been several
proposals for a powerful iteration mechanism to be called
loop
. One version is provided in Lisp Machine Lisp.
Implementors are encouraged to experiment with extensions to the
loop
syntax, but users should be advised that in all
likelihood some specific set of extensions to loop
will be
adopted in a future revision of Common Lisp.
X3J13 voted in January 1989 (LOOP-FACILITY) to include just such an
extension of loop
. See chapter 26.
Next: General Iteration
Up: Iteration
Previous: Iteration
AI.Repository@cs.cmu.edu