unifiedCall
Syntax
unifiedCall(func, args)
Arguments
func is a function.
args is a tuple. Each element is a parameter of func.
Details
Call a function with the specified parameters. Similar to call, it can be used in each/peach or loop/ploop to call a set of functions. The difference is
that the size of args in call function is determined by the function passed
in by the parameter func, whereas the size of args in
unifiedCall
is always 1. All arguments of the function used in
function call is assembled in a tuple for function unifiedCall
.
Examples
unifiedCall(sum, [1..10])
// output
55
unifiedCall(add, ([1,2,3,4,5,6,7,8,9,10],2))
// output
[3, 4, 5, 6, 7, 8, 9, 10, 11, 12]
each(unifiedCall, [std, max], [[matrix(1 3 5 7 9, 1 4 7 10 13)], [0..100]]);
col1 | col2 |
---|---|
3.1623 | 100 |
4.7434 | 100 |
def f(a,b){return (a+2)*b}
unifiedCall(f, (5,10))
//output
70