That is, is there a type safe way to make a function f that can receive an arbitrary number of parameters and a function that receives them in bulk and would work in a type safe fashion?
Say, let's have
fun<R, T1> func(f: (T1)->R, arg1: T1) { f(arg1) }
fun<R, T1, T2> func(f: (T1, T2)->R, arg1: T1, arg2: T2) { f(arg1, arg2) }
...
except that there is only a single body for func that supports an arbitrary number of such arguments?
I can accept compile time processing if there is no other way (e.g. generate the specific number of arguments in use automatically, or use a script to manually generate for up to, say, 20 arguments)