Jay
Jay

Reputation: 23

Combining varargs and higher order functions

Trying to use varargs with higher order functions. But the below doesn't seem to type/compile.

def f(n: Any*) = {...} //compiles
def f(fun: Any* => Any) = {...} // doesn't compile

Is there anyway to use varargs this way?

Upvotes: 2

Views: 147

Answers (1)

rogue-one
rogue-one

Reputation: 11577

this should work

def f(fun: (Any*) => Any) = {...}

Upvotes: 4

Related Questions