Next: Code Placement, Previous: Gathering Clauses, Up: Clauses
Several clauses can be used to alter the usual flow of control in a loop.
Note: the clauses of this and subsequent sections don't adhere to
iterate
's usual syntax, but instead use standard Common Lisp syntax.
Hence the format for describing syntax subsequently is like the
standard format used in the Common Lisp manual, not like the
descriptions of clauses above.
&optional
valueImmediately returns value (default
nil
) from the currentiterate
form, skipping the epilogue code. Equivalent to usingreturn-from
.
Skips the remainder of the loop body and begins the next iteration of the loop.
If expr ever evaluates to
nil
, the loop is terminated and the epilogue code executed. Equivalent to(if (not
expr) (finish))
.
&optional
elseIf this clause is being executed for the first time in this invocation of the
iterate
form, then the then code is evaluated; otherwise the else code is evaluated.
(for
varfirst
expr1then
expr2)
is almost equivalent to(if-first-time (dsetq var expr1) (dsetq var expr2))The only difference is that the
for
version makes var available for use withfor... previous
.