Method Function.splice_call()
- Method
splice_call
mixedsplice_call(arrayargs,function(:void)f,mixed|void...extra)- Description
Calls the given function with the
argsarray plus the optional extra arguments as its arguments and returns the result.Most useful in conjunction with map, and particularly in combination with sscanf with
"...%{...%}..."scan strings (which indeed was what it was invented for in the first place).- Parameter
args The first arguments the function
fexpects.- Parameter
f The function to apply the arguments on.
- Parameter
extra Optional extra arguments to send to
f.- Returns
Whatever the supplied function
freturns.- Example
class Product(string name, string version) { string _sprintf() { return sprintf("Product(%s/%s)", name, version); } } map(({ ({ "pike", "7.1.11" }), ({ "whitefish", "0.1" }) }), Function.splice_call, Product); ({ /* 2 elements */ Product(pike/7.1.11), Product(whitefish/0.1) })