Google provides an example of optimising a custom formula to recurse over an array where there is one. It helps with the whole efficiency thing The example provided from the Apps Script Page shows the an example where there is 1 parameter, as:
function DOUBLE(input) {
if (input.map) { // Test whether input is an array.
return input.map(DOUBLE); // Recurse over array if so.
} else {
return input * 2;
}
}
What if there are 2 or more parameters? How can we still recurse?