lua-users home
lua-l archive

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


As well the given examples are not pure lambda:

\x,y,z(x+(x-2)*g(x,y,z-2*(x+y))-y*z)
or its transformation into
function(x,y,z) return x+(x-2)*g(x,y,z-2*(x+y))-y*z end

is bound in a closure referencing "g", which is not an upvalue (an input parameter) of that function. May be it can be viewed as an output parameter but then it sould be still written as:

\x,y,z,g(x+(x-2)*g(x,y,z-2*(x+y))-y*z)
or
function(x,y,z,g) return x+(x-2)*g(x,y,z-2*(x+y))-y*z end

Closures are exactly that: they are passing additional parameters not passed explicitly by the call stack, to create a complete environment (context) where a lambda can be evaluated because all input and output variables are bound (independantly of additional local varaibles that may be defined inside the function.

Le dim. 18 nov. 2018 à 20:29, Luiz Henrique de Figueiredo <lhf@tecgraf.puc-rio.br> a écrit :
> There have been numerous discussions on this list for lambda
> notations. Were any of those accompanied by a patch so that one could
> try them out?

See http://lua-users.org/lists/lua-l/2010-11/msg00808.html .
Equivalent code for ltokenf should be straightforward.