|
It was thus said that the Great Sam Pagenkopf once stated:
> The recursive definitions are something I didn't consider. If you were to
> enable recursion in local function assignments. it would be strange because
> it violates scoping rules.
Nope, not with the Y-combinator:
local fact = Y(function(self,n)
if n == 0 then
return 1
else
return n * self(n - 1)
end
end)
print(fact(5))
Now the trick is to define Y().
-spc