scala_reference_function

scala 函数引用

1
2
3
4
5
6
def f(x:Int): Int => Int =  { n:Int => x + n }

val ff = f(2)

println(ff(3))//5
println(ff(5))//7

参考资料:
Scala: return reference to a function
小码农的碎碎念之Scala

欢迎关注我的公众号:沉迷Spring
显示 Gitment 评论
0%