lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


It was thus said that the Great Soni L. once stated:
> 
> On 06/08/16 05:30 PM, Sean Conner wrote:
> >   You just need a Y-combinator:
> >
> >	function Y(f)
> >	  local function g(...) return f(g,...) end
> >	  return g
> >	end
> >
> >	print(Y(function(rec, x)
> >			if x < 2 then
> >				return 1
> >			else
> >				return x * rec(x-1)
> >			end
> >		end)(5))
> >
> >   That will allow you to call an anonymous function recurively from within
> >the anonymous function.  No need for _SELF in this case.
> 
> That doesn't solve the dynamic variable indexing issue.

  Oh, I'm sorry I failed to read your mind again.  I thought that was what
_SUPER was for.  I'm so sorry you have to reject MY ATTEMPT to give you
something you could use and grovel that I have to have your proposal
explained to me like I'm five.

  -spc (Why do I even bother?)