lua-users home
lua-l archive

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

On Jun 5, 2014 4:18 AM, "Coroutines" <> wrote:
> On a related note, sometimes I wish Lua allowed putting an operator in
> place of where a function would be expected.  Something like:
> table.sort(some_table, <)
> I don't know how that could be made less confusing from the parsers'
> perspective, though.  I think you can do this in Haskell with \+ to
> refer to the function of the operator itself.

Sometimes I feel the need for this in Lua, but I'd *guess* it adds too much complexity to the parser for something that only a small subset of us lunatics use.

As for Haskell, it doesn't have operators per se, but everything is a function and haskell functions can be named with non alphanumeric characters. Besides, prefixed funcions can be in fixed using bacticks (5 `div` 2) and infixed ones can be passed around using parenthesis (lfold1 (+) mylist).