Why I can't invoke g2
with the second parameter in the line g2(1, _: Int)(9)
?
g2(1, _: Int)
returns a function <function1>
and then I invoke that <function1>
with parameter. At the same time in the example above I can invoke f3(9)
however it is the same as g2(1, _: Int)(9)
IMHO.
// OK
def f1: (Int, Int) => Int = _ + _
val f2: (Int, Int) => Int = f1
val f3: (Int) => Int = f2(1, _: Int)
println {
f3(9)
}
// FAIL
def g1: (Int, Int) => Int = _ + _
val g2: (Int, Int) => Int = g1
println {
g2(1, _: Int)(9) // Error: 'g2' does not take parameters
}