I am writing a function that accepts another function and it's arguments, for calling it later. How do I specify the type of function so that it can have any number of arguments?
Looking for something like this.
// this does not compile
fun doLater(func: (vararg) -> Double, args: List<Any>) {
...
}
fun footprintOne(i: int, s: String): Double {...}
fun footprintTwo(cheeses: List<Cheese>): Double {...}
// these should be able to run fine
doLater(::footprintOne, listOf(3, "I love StackOverflow"))
doLater(::footprintTwo, listOf(listOf(blueCheese, bree, havarti)))