I am curious to understand the datatype of anonymous function in Scala(2.13.8).
While reading Functional programming in Scala, I see below code
scala> (x:Int,y:Int)=> x<y
As per the book, the output should be like below
res3: (Int,Int)=> Boolean = <Function2>
But what I get is
val res3: (Int, Int) => Boolean = $Lambda$883/1341083542@7c871ce4
Below code also does not shows Function2 as type in result
scala> val lessThan = (x:Int,y:Int)=> x<y
val lessThan: (Int, Int) => Boolean = $Lambda$841/566447096@559e3f67
However, When I write the below code, I can see Function2 object is created
scala> val lessThan2 = new Function2[Int,Int,Boolean] {
| def apply(a:Int, b:Int)= a<b }
val lessThan2: (Int, Int) => Boolean = <function2>
My question is why in an anonymous function, I don't see datatype as Function2(as per the book page number 24, I should have seen it