只是想知道Currying的问题
如果我们已经定义了curried函数curriedNewSum
scala> def curriedNewSum(x : Int)(y : Int) = x + y
curriedNewSum: (x: Int)(y: Int)Int
scala> curriedNewSum(10)(20)
res5: Int = 30
scala> var tenPlus = curriedNewSum(10)_
tenPlus: (Int) => Int = <function1>
scala> tenPlus(20)
res6: Int = 30
scala> var plusTen = curriedNewSum(_)(20)
<console>:6: error: missing parameter type for expanded function ((x$1) => curri
edNewSum(x$1)(20))
var plusTen = curriedNewSum(_)(20)
^
Run Code Online (Sandbox Code Playgroud)
那么为什么curriedNewSum(10)_ works&curriedNewSum(_)(10)不是吗?
scala ×1