Varargs syntax not working for defining methods accepting functions

I want to write a method that accepts variable number of functions. So I tried doing this,

 def hello(f: (Int) => (Int)*) = {}

However this didnt work. So I had to go with the following

 def hello(f: Function1[Int, Int]*) = { }

Is this a flaw in the scala compiler?

I think the problem is just that the way you wrote it * is associated with Int, not with Int => Int. Equivalent with Function1[Int, Int*]. Doesn’t the following work?

def hello(f: (Int => Int)*) = {}
2 Likes

That was so stupid. Thanks @Jasper-M