可能重复:
What's the rationale behind curried functions in Scala?斯卡拉:两种方法之间的差异声明函数
我有两个区别的方式来声明函数:1)使用钻营。 2)使用功能作为参数。
这里是我的代码:
def transform(f: Double => Double)(input: Double) = {
f(input)
}
def transformVer2(f: Double => Double, input: Double) = {
f(input)
}
transform(x=>x*x)(10) //> res8: Double = 100.0
transformVer2(x=>x*x, 10) //> res9: Double = 100.0
我不知道是什么的上面两个函数的声明,真正的差别。请告诉我。
谢谢:)
不,我不这么认为。在我的问题中,参数是一个函数:) – hqt
它没有任何区别,它仍然是一个问题。 –