【发布时间】:2016-09-19 23:09:36
【问题描述】:
给定
scala> def method(x: Int) = x
method: (x: Int)Int
scala> val func = (x: Int) => x
func: Int => Int = <function1>
考虑以下代码:
scala> method _
res0: Int => Int = <function1>
scala> func(_)
res1: Int => Int = <function1>
scala> func _
res2: () => Int => Int = <function0>
我可以理解res0是eta扩展,res1等价于lambda函数(x) => func(x)。但我无法弄清楚res2 的输出。谁能帮我解释一下?
【问题讨论】:
-
你的意思是res2吗?
-
@kokorins 是的,我已经编辑过了。谢谢!
标签: scala