diff options
Diffstat (limited to 'continuation3.mu')
-rw-r--r-- | continuation3.mu | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/continuation3.mu b/continuation3.mu new file mode 100644 index 00000000..043828d5 --- /dev/null +++ b/continuation3.mu @@ -0,0 +1,21 @@ +# example program showing that a function call can be 'paused' multiple times, +# creating different continuation values + +def main [ + local-scope + $print [caller 0] 10/newline + k:continuation <- call-with-continuation-mark f + $print [caller 1] 10/newline + k <- call k + $print [caller 2] 10/newline + call k +] + +def f [ + local-scope + $print [callee 0] 10/newline + return-continuation-until-mark + $print [callee 1] 10/newline + return-continuation-until-mark + $print [callee 2] 10/newline +] |