lua-users home
lua-l archive

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


> But there is a middle way; say there was a new keyword 'lambda', so
> that we can say lambda(arglist) expr, then a token filter could easily
> transform |x| into lambda(x).

Why 'lambda' when 'function' exists and works just as well?
And one possible syntax could be
	function (x,y,z)=x+y*z
which is reminiscent of Fortran one-line function statements except that
defines anonymous functions.

This syntax is even friendlier to token filters because you only need to
convert '=' to 'return' but the real problem is of course how to detect
the end of the expression so that 'end' can be added.