Reputation: 2672
Suppose I have this code:
def a(x:Int,y:Int):Int = x+y
def b:(Int,Int) = (1,2)
and I would like to accomplish:
a(b)
What is the proper way of doing this? Also are there more efficient ways of calling a predefined multi-parameter function - in my case 8 - with the results of another function?
Upvotes: 4
Views: 1412
Reputation: 1031
how about:
scala> (a _).tupled(b)
res0: Int = 3
a _
gives you a partially applied function.Upvotes: 6