I’m in doubt what to call a high-order function that transforms a function so it uses an array instead of an argument-list. It’s complicated to explain in words, so there’s an example in JavaScript:
sum = function(a,b){ return a+b; };
foo = function(fn){
return function(arr){
return fn.apply(fn,arr);
};
};
different_sum = foo(sum);
log(sum(2,3)); //5
log(different_sum([2,3])); //5
There’s a similar method for Scala functions that takes an n-ary function and returns a unary function that takes an n-tuple as the only argument. They call the method
tupled, and you can see it in the documentation forFunction5(or any of the other function arities greater than 1).