2006-03-29
Generators in Common Lisp
Matthew Swank posted an example of generators using Common Lisp in comp.lang.lisp.
His implementation contains a monadic implementation of continuations and call/cc which is quite nice, and the resulting thread has a dicussion on the some implementation variations. A simple example of using the call/cc implementation from later in the thread:
;; Scheme version
(call/cc (lambda (k) (k 42)))
;; Common Lisp
(run (call/cc (lambda (k) (funcall k 42))))