1. Module (chicken continuation)
    1. Continuations API
      1. continuation-capture
      2. continuation?
      3. continuation-graft
      4. continuation-return

Module (chicken continuation)

This module provides a more powerful interface for continuations than that provided by call/cc.

More information about this continuation API can be found in the paper A Better API for First-Class Continuations by Marc Feeley.

Continuations API


[procedure] (continuation-capture PROCEDURE)

Creates a continuation object representing the current continuation and tail-calls PROCEDURE with this continuation as the single argument.


[procedure] (continuation? X)

Returns #t if X is a continuation object, or #f otherwise. Please note that this applies only to continuations created by the Continuation API, but not by call/cc, i.e.: (call-with-current-continuation continuation?) returns #f, whereas (continuation-capture continuation?) returns #t.


[procedure] (continuation-graft CONT THUNK)

Calls the procedure THUNK with no arguments and the implicit continuation CONT.


[procedure] (continuation-return CONT VALUE ...)

Returns the value(s) to the continuation CONT. continuation-return could be implemented like this:

(define (continuation-return k . vals)
    (lambda () (apply values vals))))

Previous: Module (chicken condition)

Next: Module (chicken csi)