lua-users home
lua-l archive

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


> Did you try this code? I think it is what you might be looking for,
> actually. Although you can do it with unpack() etc.

Yes, curry is simply:

-- curry: Partially apply a function
--   f: function to apply partially
--   a1 ... an: arguments to fix
-- returns
--   g: function with ai fixed
function curry (f, ...)
  local fix = arg
  return function (...)
           return f (unpack (fix), unpack (arg))
         end
end

which is a lot simpler than messing around with C.

-- 
http://www.mupsych.org/~rrt/ | Caution Children At Play Drive Slowly (Anon)