1
IM试图理解Scala中的下面的高阶函数,但需要对函数的参数进行一些说明。Scala中的高阶函数
问题: -
- 是什么在
apply
功能Int => String
是什么意思?v: Int
表示参数v的类型为Int
。 [A](x: A)
是什么意思layout
函数?object Demo { def main(args: Array[String]) { println(apply(layout, 10)) } def apply(f: Int => String, v: Int) = f(v) def layout[A](x: A) = "[" + x.toString() + "]" }