I want to make some function for unspecified number of arguments of function
for example
scala> def test(fx: (String*) => Boolean, arg: String*): Boolean = fx(arg: _*)
test: (fx: String* => Boolean, arg: String*)Boolean
scala> def AA(arg1: String, arg2: String) :Boolean = {
println ("Arg1 : " + arg1 + " Arg2 : " + arg2)
true}
AA: (arg1: String, arg2: String)Boolean
scala> test(AA,"ASDF","BBBB")
<console>:10: error: type mismatch;
found : (String, String) => Boolean
required: String* => Boolean
test(AA,"ASDF","BBBB")
^
How can I solve this problem??
argsa different numbers of values thatfxexpects? Is that OK with you?testmethod does nothing more than calling the passed function so it's hard to guess why you cannot directly call the function in the first place (and thus hard to propose any potentially saner alternative)