[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: How to do actual recursive functions in Lua?
- From: "Ge' Weijers" <ge@...>
- Date: Mon, 23 Mar 2009 08:18:32 -0700
There's the Y combinator trick:
print(( function(f)
return function(i)
return f(f, i)
end
end)(function(fac, n)
if n > 1 then
return n * fac(fac, n-1)
else
return 1
end
end)(10))