lua-users home
lua-l archive

looking for ``apply'' function

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


Hello,
is there some function which behaves according to the following
signature and semantics description?
function apply(f, a) {
-- f is a function. a is an array. Depending on the dimension of a,
-- apply shall return
-- f() -- for dimension == 0 (empty array) resp.
-- f(a[1]) -- for dimension == 1 resp.
-- f(a[1], a[2]) -- for dimension == 2 resp.
-- f(a[1], a[2], a[3]) -- for dimension == 3 resp.
-- ...
}
Regards
 Thomas

AltStyle によって変換されたページ (->オリジナル) /