lua-users home
lua-l archive

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


> the implementation.  A syntax like this may be preferable:
>
>     SomeType "abc" {
>         1,
>         2,
>         3,
>     }

i.e. currying! Lovely. The only problem is that this only works with strings
and tables, not numbers. If only we were allowed to have:

f 3  => f(3)

then we could write

function plus(a) return function (b) return %a + b end end

plus 3 4

...but this is not legal syntax. You have to write plus(3), and then can't
apply the result directly to 4, so you need:

a = plus(3)
a(4)

blech.

One other annoyance is that you can't directly apply an anonymous function:

(function (x) print(x) end) "hello"

is illegal.

-- 
http://sc3d.org/rrt/ | computation, n.  automated pedantry