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 def main [
 5   local-scope
 6   l:&:list:num <- copy 0
 7   l <- push 3, l
 8   l <- push 2, l
 9   l <- push 1, l
10   k:continuation <- call-with-continuation-mark create-yielder, l
11   {
12   ¦ x:num, done?:bool <- call k
13   ¦ break-if done?
14   ¦ $print x 10/newline
15   ¦ loop
16   }
17 ]
18 
19 def create-yielder l:&:list:num -> n:num, done?:bool [
20   local-scope
21   load-ingredients
22   return-continuation-until-mark
23   done? <- equal l, 0
24   return-if done?, 0
25   n <- first l
26   l <- rest l
27 ]