Subject: Re: call/cc
From: (Rob Warnock)
Date: Thu, 06 Apr 2006 06:10:50 -0500
Newsgroups: comp.lang.lisp
Message-ID: <>
Philippe Lorin  <> wrote:
| Pascal Costanza wrote:
| > What do you actually want to express?
| It's a kind of cooperative multitasking.
| I need three things: CSTART, CSTEP and YIELD.

CMUCL's "multiprocessing" (green threads, really) can easily do this
[given some trivial wrappers], as can SBCL and several other Common
Lisps with threads. In the case of CMUCL, I think this [untested]
does approximately what you asked for:

    (defmacro cstart (&body body)
      `(mp:make-process (lambda () (yield) ,@body)))

    (defun cstep (c)
      (mp-enable-process c))

    (defun yield ()
      (mp-disable-process mp:*current-process*))


Rob Warnock			<>
627 26th Avenue			<URL:>
San Mateo, CA 94403		(650)572-2607