let output = fn n -> begin let s = get in (thd3 s) ++ " " ++ n end in let consumer = fn gen -> begin let s = get in begin set (triple (pair (fst (fst3 s)) gen) (snd3 s) (thd3 s)); while fst (fst3 get) < 10 do begin let s = get in let n = fst (fst3 s) in let gen = snd (fst3 s) in let o = output n in set (triple (pair (n+1) (snd (fst3 s))) (snd3 s) o); let rest = callcc gen in let s = get in set (triple (pair (fst (fst3 s)) rest) (snd3 s) (thd3 s)) end end end in let generator = fn con -> begin let s = get in begin set (triple (fst3 s) (pair (fst (snd3 s)) con) (thd3 s)); while fst (snd3 get) > 0 do begin let s = get in let n = fst (snd3 s) in let con = snd (snd3 s) in let o = output n in set (triple (fst3 s) (pair (n-1) (snd (snd3 s))) o); let rest = callcc con in let s = get in set (triple (fst3 s) (pair (fst (snd3 s)) rest) (thd3 s)) end end end in let state = triple (pair 0 generator) (pair 10 consumer) Unit in begin set state; consumer generator; get end