1 # Example program showing that 'return-continuation-until-mark' can 'pause' a
 2 # function call, returning a continuation, and that calling the continuation
 3 # can 'resume' the paused function call.
 4 #
 5 # To run:
 6 #   $ git clone https://github.com/akkartik/mu
 7 #   $ cd mu
 8 #   $ git checkout 4a48bedcd1  # state as of this writing; later versions may be incompatible
 9 #   $ ./mu continuation1.mu
10 #
11 # Expected output:
12 #   1
13 
14 def main [
15   local-scope
16   k:continuation <- call-with-continuation-mark create-yielder
17   x:num <- call k  # should return 1
18   $print x 10/newline
19 ]
20 
21 def create-yielder -> n:num [
22   local-scope
23   load-inputs
24   return-continuation-until-mark
25   return 1
26 ]