lua-users home
lua-l archive

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


Do you mean the Y combinator ?

http://en.wikipedia.org/wiki/Y_combinator

--- Patrick Donnelly <batrick@hotmail.com> wrote:

> I know this has been talked about before, and I read
> all the posts in the archive on this. There wasn't
> an "accepted" method for going about it, so I
> wondered if this implementation is optimal:function
> execute(func, ...)  return func(...);end;function
> test(s)  return execute(function(f)    local fact;  
>  fact = function(n, ret)      ret = ret or 1;     
> if n == 0 then return 1 * ret end;      return
> fact(n - 1, n * ret);    end;    return fact(f); 
> end, s);end;test(3) --> 6Comments?-Patrick Donnelly
> 
> "One of the lessons of history is that nothing is
> often a good thing to do and always a clever thing
> to say." 
> 
> -Will Durant



       
____________________________________________________________________________________
Looking for a deal? Find great prices on flights and hotels with Yahoo! FareChase.
http://farechase.yahoo.com/