我在scala中有以下功能
现在我想将currying应用于此功能
scala> def add(x:Int,y:Int) = x+y
add: (x: Int, y: Int)Int
scala> val addCurried = Function.curried(add_)
<console>:7: error: value curried is not a member of object Function
val addCurried = Function.curried(add_)
^
scala> val addCurried = Function.curried(add _)
<console>:8: error: value curried is not a member of object Function
val addCurried = Function.curried(add _)
这里出了什么问题?如何将currying应用于scala中的exixting函数
答案 0 :(得分:1)
val addCurried = (add _).curried
如您所见[{3}},curried
对象上没有Function
方法。