[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: The Curry Challenge
- From: Javier Guerra <javier@...>
- Date: Thu, 11 Jan 2007 18:52:42 -0500
On Thursday 11 January 2007 6:39 pm, Jerome Vuarand wrote:
> -- Non-recursive with arrays
> function curry(f, ...)
> local cargs = {...}
> return function(...)
> local args = {}
> for _,v in ipairs(cargs) do args[#args+1] = v end
> for _,v in ipairs({...}) do args[#args+1] = v end
> return f(unpack(args))
> end
> end
i think a worthwhile feature for the next Lua (5.2?) would be to make unpack()
accept several arrays and return the list of the concatenation of all. of
course, if there's more than one array, there shouldn't be any i,j parameters
(who uses those, anyway?).
--
Javier
Attachment:
pgp0MzHUvOQy2.pgp
Description: PGP signature