[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: _SELF and _SUPER
- From: Sean Conner <sean@...>
- Date: Sat, 6 Aug 2016 16:30:56 -0400
It was thus said that the Great Soni L. once stated:
> On 06/08/16 06:19 AM, Tim Hill wrote:
> >A more interesting question .. why do you need this? And, for your
> >need, have you explored other ways to solve the problem within the
> >existing Lua language?
> I've used recursive pseudo-anonymous functions before. _SELF would make
> them easier to use.
> local function inside_anonymous(args, I, should, take)
> return inside_anonymous
You just need a Y-combinator:
local function g(...) return f(g,...) end
if x < 2 then
return x * rec(x-1)
That will allow you to call an anonymous function recurively from within
the anonymous function. No need for _SELF in this case.
-spc (Now, about that _SUPER ... )