lua-users home
lua-l archive

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


> --- Reuben Thomas wrote:
> > Yes, curry is simply:
> >
> > function curry (f, ...)
> >   local fix = arg
> >   return function (...)
> >            return f (unpack (fix), unpack (arg))
> >          end
> > end
>
> You don't need the 'fix', because a unique table is passed in every
> time the function is called:

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.

-- 
http://www.mupsych.org/~rrt/ | Analogy midwives, identity murders