lua-users home
lua-l archive

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


Aaron Brown wrote:
>
> [...] a function
> that works just like unpack but takes multiple arguments
> (i.e., multunpack({1, 2}, {3, 4}) returns 1, 2, 3, and 4).
> Is there a good reason why the stock unpack shouldn't do
> this?

Maybe a suggestion was simply missing :-)

To unpack all args sounds sane to me.


> One time I wrote a curry function [...]

You too? *g*  My first implementation was like this:

  local function _bind(f, a, ...)
    return bind(function(...) return f(a, ...) end, ...)
  end 

  function bind(f, ...)
    if argn(...) == 0 then
      return f
    else
      return _bind(f, ...) end
  end 

But later on I made a C version part of baselib ;-)

Ciao, ET.