Reputation: 20435
Let
def f(i:Int)(j:Int) = i + j
and so
f(1) _
Int => Int = <function1>
However,
val f: (Int)(Int) => Int = (a:Int)(b:Int) => a + b // wrong
namely, error: ';' expected but '(' found.
How to declare val f
?
Upvotes: 0
Views: 47
Reputation: 37852
Is this what you were looking for?
scala> val f: Int => Int => Int = a => b => a + b
f: Int => (Int => Int) = <function1>
scala> f(1)
res7: Int => Int = <function1>
scala> f(1)(2)
res8: Int = 3
Upvotes: 2