Type information in the Scala REPL

后端 未结 2 1350
离开以前
离开以前 2021-01-25 00:54

If I\'m using the F# interpreter, I can define a simple function like this:

> // Function to check if x is an integer multiple of y
> let multipleOf x y =          


        
2条回答
  •  孤城傲影
    2021-01-25 01:47

    scala> val f = (i: Int, j: Int) => i % j == 0
    f: (Int, Int) => Boolean = 
    
    scala> f
    res2: (Int, Int) => Boolean = 
    
    scala> def multipleOf(x: Int, y: Int) = x % y == 0
    multipleOf: (x: Int, y: Int)Boolean
    
    scala> :type multipleOf(_, _)
    (Int, Int) => Boolean
    

提交回复
热议问题