[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: RE: callback implementation details..
- From: Eric Tetz <erictetz@...>
- Date: Fri, 17 Oct 2003 16:18:17 -0700 (PDT)
--- Reuben Thomas <rrt@sc3d.org> wrote:
> I don't think you're right: in the code below:
>
> > function curry (f, ...)
> > return function (...)
> > return f (unpack(arg))
> > end
> > end
>
> you don't keep the fixed arguments. All you do is call f on
whatever the
> function gets, i.e. your curry (f) is the same as f.
Well, I stated the wrong reason (which I realized the second I
clicked "submit"). You don't need 'fix' because you already have a
local to bind the closure to: 'arg'.
This function:
> function curry (f, ...)
> local fix = arg
> return function (...)
> return f (unpack (fix), unpack (arg))
> end
> end
Creates a second local referring to the same table, then passes
passes the same argument list to 'f' twice.
__________________________________
Do you Yahoo!?
The New Yahoo! Shopping - with improved product search
http://shopping.yahoo.com