Hacker News new | ask | show | jobs
by lisper 5719 days ago
http://rondam.blogspot.com/2008/02/joy-of-iterators.html

This lets you write things like:

(for var in form do ...

or

(for var in form collect ...

where form can be anything that has an iterator method defined on it.

There's also a macro I use called BINDING-BLOCK (BB for short) which subsumes a bunch of binding forms. So you can write things like:

(bb

  x (...)

  y (...)

  :db (q r s) (...) ; Destructuring-bind

  :mv (p q) (...) ; Multiple-value-bind

  ...

It's extensible so you can add your own clauses. Code is here:

http://www.flownet.com/ron/lisp/rg-utils.lisp

(It's a little out of date. If you want the latest let me know and I'll update it.)