1 # Example program showing that a 'paused' continuation can be 'resumed'
 2 # multiple times from the same point (but with changes to data).
 3 #
 4 # Expected output:
 5 #   1
 6 #   2
 7 #   3
 8 
 9 def main [
10   local-scope
11   l:&:list:num <- copy 0
12   l <- push 3, l
13   l <- push 2, l
14   l <- push 1, l
15   k:continuation <- call-with-continuation-mark create-yielder, l
16   {
17   ¦ x:num, done?:bool <- call k
18   ¦ break-if done?
19   ¦ $print x 10/newline
20   ¦ loop
21   }
22 ]
23 
24 def create-yielder l:&:list:num -> n:num, done?:bool [
25   local-scope
26   load-ingredients
27   return-continuation-until-mark
28   done? <- equal l, 0
29   return-if done?, 0
30   n <- first l
31   l <- rest l
32 ]