source: project/wiki/man/5/Module (chicken continuation) @ 35525

Last change on this file since 35525 was 35525, checked in by felix, 6 months ago

man/5: restructuring, fixed links, added csi module, simplification

File size: 1.5 KB
Line 
1[[tags: manual]]
2[[toc:]]
3
4== Module (chicken continuation)
5
6This module provides a more powerful interface for continuations than that
7provided by {{call/cc}}.
8
9More information about this continuation API can be found in the paper
10[[http://repository.readscheme.org/ftp/papers/sw2001/feeley.pdf]] ''A Better
11API for first class Continuations'' by Marc Feeley.
12
13
14=== Continuations API
15
16==== continuation-capture
17
18<procedure>(continuation-capture PROCEDURE)</procedure>
19
20Creates a continuation object representing the current continuation and
21tail-calls {{PROCEDURE}} with this continuation as the single argument.
22
23
24==== continuation?
25
26<procedure>(continuation? X)</procedure>
27
28Returns {{#t}} if {{X}} is a continuation object, or {{#f}} otherwise. Please
29note that this applies only to continuations created by the Continuation API,
30but not by call/cc, i.e.: {{(call-with-current-continuation continuation?)}}
31returns {{#f}}, whereas {{(continuation-capture continuation?)}} returns
32{{#t}}.
33
34
35==== continuation-graft
36
37<procedure>(continuation-graft CONT THUNK)</procedure>
38
39Calls the procedure {{THUNK}} with no arguments and the implicit continuation
40{{CONT}}.
41
42
43==== continuation-return
44
45<procedure>(continuation-return CONT VALUE ...)</procedure>
46
47Returns the value(s) to the continuation {{CONT}}. {{continuation-return}} could
48be implemented like this:
49
50<enscript highlight=scheme>
51(define (continuation-return k . vals)
52  (continuation-graft
53    k
54    (lambda () (apply values vals))))
55</enscript>
56
57
58----
59Previous: [[Module (chicken condition)]]
60
61Next: [[Module (chicken csi)]]
Note: See TracBrowser for help on using the repository browser.