[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Syntax lollipops
- From: Sean Conner <sean@...>
- Date: Thu, 28 Feb 2013 02:31:48 -0500
It was thus said that the Great Miles Bader once stated:
> Dirk Laurie <email@example.com> writes:
> > How many characters do you save?
> > local function func(x,y)
> > local func=function(x,y)
> > Zero. That's right, nada, nichts, rien, zilch.
> ... unless the function is recursive, in which case, a fair number.
> [And self-recursive functions are fairly common...]
And that's why you have the Y-combinator:
local function g(...) return f(g,...) end
print(Y(function(rec, x) if x < 2 then return 1 else return x * rec(x-1) end end)(5))
-spc (Now all we need is call/cc ... 8-P