lua-users home
lua-l archive

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

On Thu, Dec 3, 2009 at 11:50 AM, David Kastrup <> wrote:
> function(x) return x*(x-1) end

The notation really shines when you start doing functional things like currying:

> div = |x| |y| x/y
> = div(1)(10)

But the real motivation is that it makes using functions like 'map' a
little more pleasing:

squares = map(|x| x*x, values)

Also, for 'quoting' an expression so that it can be called in another context:

timer(1000,|| print 'timer finished')

Perhaps the issue here is that those two little lines are easy to get
lost in the otherwise keyword-driven syntax of Lua?

steve d.