given the following input:
scala> val as = List(Array(1,2,3), Array(10,20,30), Array(100,200,300))
as: List[Array[Int]] = List(Array(1, 2, 3), Array(10, 20, 30), Array(100, 200, 300))
I am wondering why this works:
EXAMPLE 1
scala> as.reduce((x,y) => x)
res65: Array[Int] = Array(1, 2, 3)
But this seemly identical thing does not work:
EXAMPLE 2
scala> as.reduce{case(x,y) => x}
<console>:13: error: missing parameter type for expanded function
The argument types of an anonymous function must be fully known. (SLS 8.5)
Expected type was: (?, ?) => ?
as.reduce{case(x,y) => x}
Can anyone explain why the 1st example works but not the 2nd example?