Seq(1, 2, 3).reduce(math.max) // ok: gives 3
Seq[Long](1, 2, 3).reduce(math.max) // error: type mismatched
^^^^^^^^
Why it cannot deduce the Long
version of math.max
?
Seq[Long](1, 2, 3).reduce(math.max(_:Long, _:Long)) // ok: gives 3L
^^^^^^^^^^^^^^^^^^^^^^^^
Above can solve the problem, but is there any short/clean way to tell the compiler to select Long
version of math.max
?