【发布时间】:2013-10-02 22:04:46
【问题描述】:
Scala中以下两个函数定义有什么区别:
1) def sum(f: Int => Int)(a: Int, b: Int): Int = { <code removed> }
2) def sum(f: Int => Int, a: Int, b: Int): Int = { <code removed> }
?
SBT 的控制台 REPL 为它们提供了不同的值,所以看看它们是否有所不同:
sum: (f: Int => Int, a: Int, b: Int)Int
sum: (f: Int => Int)(a: Int, b: Int)Int
【问题讨论】:
标签: function scala functional-programming higher-order-functions