On 09/30/2010 01:39 PM, Lyle Kopnicky wrote:
[...]
You could also, as Waclaw points out, bury the FactLoop definition
inside Fact:
fun {Fact N}
fun {Loop I N Acc}
if I==N
then Acc
else {Loop I+1 N (I+1)*Acc.1|Acc}
end
end
in
{Loop 1 N [1]}
end
... and then you don't really need N as an argument to Loop, as it is
constant there and can be accessed from the closure:
fun {Fact N}
fun {Loop I Acc}
if I==N
then Acc
else {Loop I+1 (I+1)*Acc.1|Acc}
end
end
in
{Loop 1 [1]}
end
--
vQ
_________________________________________________________________________________
mozart-users mailing list
[email protected]
http://www.mozart-oz.org/mailman/listinfo/mozart-users