diff options
-rw-r--r-- | callcc.mu | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/callcc.mu b/callcc.mu new file mode 100644 index 00000000..c9edfa47 --- /dev/null +++ b/callcc.mu @@ -0,0 +1,18 @@ +# example program: saving and reusing call-stacks or continuations + +recipe main [ +#? $start-tracing #? 1 + c:continuation <- f + continue-from c:continuation # <-- ..when you hit this +] + +recipe f [ + c:continuation <- g + reply c:continuation +] + +recipe g [ + c:continuation <- current-continuation # <-- loop back to here + $print 1:literal + reply c:continuation +] |