Right Arrow meanings in Scala

前端 未结 3 1488
旧巷少年郎
旧巷少年郎 2020-12-13 09:45

In Chapter 9 of Programming In Scala, there is an example method like this:

def twice(op: Double => Double, x: Double) = op(op(x))

The

3条回答
  •  无人及你
    2020-12-13 10:33

    That is a function that takes a double and returns a double.

    scala> def  d2d = (d:Double) => d 
    d2d: (Double) => Double
    

    It's type is Function1[Double,Double]

提交回复
热议问题