lua-users home
lua-l archive

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


On Sun, Feb 26, 2012 at 04:13:19PM -0700, HyperHacker wrote:
> Wouldn't a more Lua-like approach be to use a keyword "lambda" instead
> of a symbol? I think my favourite syntax would be:
> lambda x: x+1
> but that might be difficult to parse, since x:x looks like a function
> call, so maybe you'd need a double colon.
> lambda x (x+1) -- has the same problem, but even moreso since x(x+1)
> is actually a valid statement.

What about something like
    lambda x -> x + 1
or 
    lambda x => x + 1
???

Though, I'm not certain I see the difference between this and, say,
    function (x) return x + 1 end
other than it's a little shorter (though, a little syntatic sugar never
hurt anyone).

-- 
Christopher Berardi
http://www.natoufa.com/

May grace and peace by yours in abundance.