scala> x
val res18: List[(String, Int)] = List((a,2), (b,1), (c,3))
scala> x.sortBy(-_._2)
val res20: List[(String, Int)] = List((c,3), (a,2), (b,1))
scala> x.sortBy(x=>-(x._2))
^
error: value =>- is not a member of List[(String, Int)]
^
error: value _2 is not a member of List[(String, Int)]
The first sortBy works. While the second does not work.
Can you help explain it?
Thanks in advance.