1 # Example program showing that a function call can be 'paused' multiple times, 2 # creating different continuation values. 3 # 4 # Expected output: 5 # caller 0 6 # callee 0 7 # caller 1 8 # callee 1 9 # caller 2 10 # callee 2 11 12 def main [ 13 local-scope 14 $print [caller 0] 10/newline 15 k:continuation <- call-with-continuation-mark f 16 $print [caller 1] 10/newline 17 k <- call k 18 $print [caller 2] 10/newline 19 call k 20 ] 21 22 def f [ 23 local-scope 24 $print [callee 0] 10/newline 25 return-continuation-until-mark 26 $print [callee 1] 10/newline 27 return-continuation-until-mark 28 $print [callee 2] 10/newline 29 ]