lua-users home
lua-l archive

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


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: pgpg_cXWN0lee.pgp
Description: PGP signature