Common Lisp Extensions. Node: Loop Facility

PREV Iteration UP Control Structure NEXT Multiple Values

5.7: Loop Facility

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'
  • PREV Iteration UP Control Structure NEXT Multiple Values