lua-users home
lua-l archive

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


In message <20180911201431.GA3860@arraial.inf.puc-rio.br>
          Roberto Ierusalimschy <roberto@inf.puc-rio.br> wrote:

>The problem here is not the assignment per se, but the fact that 'g'
>is recursive, so it only moves the recursion from one place to another.
>The following version does not use recursion (although this particular
>one is usually called Z, not Y):
>
>local Y = function (le)
>      local a = function (f)
>        return le(function (...) return f(f)(...) end)
>      end
>      return a(a)
>    end

What a mind-twisting beautiful combinator! I remember an amusingly
illustrated article called "The Care and Feeding of Combinators",
produced in the early 80s as light entertainment for a conference on
functional programming. Alas, it is no longer on my shelf. Lua is
not generally advertised as a functional programming language, but
of course it is - among other things.

--
Gavin Wraith (gavin@wra1th.plus.com)
Home page: http://www.wra1th.plus.com/