I am a newbie in Scala and am trying to understand partially applied functions. I can implement simple examples like when function takes two integers as input. But I wanted to combine variable number of arguments with partially applied functions without using currying. I haven't studied much on currying so am not using that totally. This is all I could come up with which doesn't work.
def func1(a:Int, b:Int*) {
println(a)
}
val func2 = func1(2,_) // error - type mismatch;
// found : Seq[Int]
// required: Int
Can anyone tell how to preserve the varargs such that I can still call func2 like func2(2,3,4)? I have seen examples using currying but haven't seen anyone without that
It's not duplicate of Error with varargs for function-objects in Scala? because the mentioned question asks for implementing varargs in function literals and my question is totally different. At first, I am using method (not function literals). Secondly, I am asking for implementing partially applied functions with varargs (which is nothing in relation to the mentioned question)