[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: RE: callback implementation details..
- From: Eric Tetz <erictetz@...>
- Date: Fri, 17 Oct 2003 16:18:17 -0700 (PDT)
--- Reuben Thomas <email@example.com> 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
> 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'.
> function curry (f, ...)
> local fix = arg
> return function (...)
> return f (unpack (fix), unpack (arg))
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