【发布时间】:2017-08-15 18:08:08
【问题描述】:
我是 Scala 的新手,并试图在函数式方法中进行更多探索。
我写了一个方法并定义了一个这样的变量:-
val list = 1 to 10 toList
def getFilterList(list: List[Int],f:Int => Boolean): List[Int] = {
list.filter(f)
}
getFilterList(list, x => x %2 ==0)
val oddHOF :Int => Boolean = value => value % 2 == 0
list.filter(oddHOF)
现在,我的问题是,oddHOF 和 getFilterList 都是高阶函数,如果不是,那么 oddHOF 和 getFilterList 会被调用吗?
【问题讨论】:
标签: scala higher-order-functions