【发布时间】:2017-06-30 00:53:19
【问题描述】:
我比较了在 Scala 中定义 higher-order function 的两种方式:
def f1(elem: Int)(other: Int) = (elem == other)
def f2(elem: Int) = (other: Int) => (elem == other)
第一个使用currying,第二个使用anonymous function。
我想知道这两种方法在 Scala 如何实现它们以及哪个版本更可取方面有什么区别(如果有的话)?
【问题讨论】:
标签: scala functional-programming anonymous-function higher-order-functions currying