小编use*_*321的帖子

Scala函数定义参数列表中的不同括号样式

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

functional-programming scala function higher-order-functions

6
推荐指数
1
解决办法
382
查看次数