Thursday, January 29, 2009

Ch3, Ex4

declare Factorial
fun {Factorial N}
fun {IterFactorial X Y}
if X<1 then Y
else
{IterFactorial X-1 Y*X}
end
end
in
{IterFactorial N 1}
end
{Browse {Factorial 5}}

No comments:

Post a Comment