lua-users home
lua-l archive

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


On Feb 28, 2012, at 5:08 PM, Sam Roberts wrote:

> Its been pointed out before, that using strings and parsing them and
> returning a function is a way of providing this
> kind of terseness in an environment that requires it:
> 
> table.sort(T, lambda[[|x,y|(x>  y)]])
> table.sort(T, lambda"|x,y|(x>  y)")
> table.sort(T, L"|x,y|(x>  y)")
> 
> A bit of a pain, but if you have so many uses of these tiny
> expressions you are dying for a lambda, maybe not too much.

The pain is the lack of compile time syntax checking and the ability to capture upvalues (though maybe that latter point is compensated for by also preventing a proliferation of closure constructions).

Mark