UtilCont のソースプログラムを入力して下さい。
foo = \ n ->
begin
set xP 1;
set yP n;
while get yP > 0 do
begin
val r = get xP in
val n = get yP in
begin
if n == 10 then break
else if n == 3 then
begin
set xP r;
set yP (n - 1);
continue
end
else ();
set xP (r * n);
set yP (n - 1)
end
end;
get xP
end
;
bar = \ x -> begin
set xP 1;
label1:
if get xP > 100 then
goto label2
else ();
set xP (get xP * 2);
goto label1;
label2:
get xP
end
;
fact = \ n -> if n == 0 then 1 else n * fact (n - 1)
;
increase n k =
if n > 10 then ()
else begin writeStr " i:"; write n;
increase (n + 1) (callcc (\ c -> unTrick k (Trick c))) end
;
decrease n k =
if n < 0 then ()
else begin writeStr " d:"; write n;
decrease (n - 1) (callcc (\ c -> unTrick k (Trick c))) end
;
coroutine x = increase 0 (Trick (decrease x))