lua-users home
lua-l archive

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


--- Reuben Thomas <rrt@sc3d.org> wrote:
> No, fix and arg refer to different tables.

Ahhhh... I see what you're doing now. Good idea. It allows the
closure to receive additional arguments when it's called.

However, it won't work as written because in the expression:

f(unpack(fix), unpack(arg))

f will only receive the first value returned by 'unpack(fix)' and
all the values returned by 'unpack(arg)' For instance, this code:

cb = curry( function(a,b,c) print(a,b,c) end, "a", "b", "d")
cb()
cb(1,2,3)

Will output:

a       nil     nil
a       1       2

Personally I've always found that behavior to be one of Lua's
warts.


__________________________________
Do you Yahoo!?
The New Yahoo! Shopping - with improved product search
http://shopping.yahoo.com