Next: Multiple Values, Previous: Iteration, Up: Control Structure [Contents][Index]
A common complaint with Lisp’s traditional looping constructs is
that they are either too simple and limited, such as Common Lisp’s
dotimes
or Emacs Lisp’s while
, or too unreadable and
obscure, like Common Lisp’s do
loop.
To remedy this, recent versions of Common Lisp have added a new
construct called the “Loop Facility” or “loop
macro,”
with an easy-to-use but very powerful and expressive syntax.
• Loop Basics: | ‘loop’ macro, basic clause structure | |
• Loop Examples: | Working examples of ‘loop’ macro | |
• For Clauses: | Clauses introduced by ‘for’ or ‘as’ | |
• Iteration Clauses: | ‘repeat’, ‘while’, ‘thereis’, etc. | |
• Accumulation Clauses: | ‘collect’, ‘sum’, ‘maximize’, etc. | |
• Other Clauses: | ‘with’, ‘if’, ‘initially’, ‘finally’ |