lua-users home
lua-l archive

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


On Wed, Nov 24, 2010 at 7:32 AM, steve donovan
<steve.j.donovan@gmail.com> wrote:
> On Wed, Nov 24, 2010 at 2:29 PM, Axel Kittenberger <axkibe@gmail.com> wrote:
>> myfunc(function(x) return x end, x)
> As for multiple returns, probably best either to not allow it or
> require explicit parens
>
> lambda(x) (x-1,x+1)
   How about @(x-1, x+1), with default args of x, y, and z? Otherwise
e.g. @([a,b] a-b, a+b) I may work on a patch for that over the
weekend.

   For anything larger, "function(x) return foo end" is fine, but
function/return/end adds a lot of noise in a big table full of very
short callbacks.

   Either way, I would strongly suggest to avoid using the word
"lambda". It's longer and less clear than several alternatives (e.g.
"fun"). Programmers familiar with the lambda calculus are really not
the majority, and it's pretty opaque to non-programmers just using Lua
as a config file format.

Scott