iterate
iterate is a lispy and extensible replacement for the LOOP macro.

It was written by Jonathan Amsterdam at MIT and recently ported to Common Lisp.

The canonical site for information about iterate is at http://common-lisp.net/project/iterate/.

Some examples:

(iterate (for (key . item) in alist)
  (collect key into keys)
  (collect item into items)
  (finally (return (values keys items))))
collects keys and items of an alist into two values

It also supports generators:

(iterate (generate i from 0 to 6)
  (for (key . value) in '((a . 2) (zero . 10) (one . 20) (d . 5)))
  (when (>= value 10)
    (collect (cons key (next i)))))

   => ((ZERO . 0) (ONE . 1))

and allows easy finding of extrema:

(iterate (for elt in list-of-lists)
  (finding elt maximizing (length elt)))
finds the longest list in a list of lists and generates pretty fast code, too. (-:

The recent ASDF-installable package is at:

ASDF-install package (obsolete) http://common-lisp.net/project/iterate/releases/iterate-current.tar.gz


language extension