Your interpretation is correct. But you do not need all these curly braces.
def mul(a: Int)(b: Int) = a*b val mulAB = (a: Int) => { (b: Int) => a*b } // Same as mul _ val mul5B = (b: Int) => 5*b // Same as mulAb(5) or mul(5) _
In the general case, you can rewrite any function with several arguments in the form of a carded chain, where each argument creates a function that takes another argument until the last one really gives a value:
f(a: A ,b: B ,c: C, d: D): E <===> A => B => C => D => E
In Scala, natural grouping is done by a parameter block, not a separate parameter, so
f(a: A)(b: B, c: C)(d: D): E <===> A => (B,C) => D => E
source share