exercises-scalatutorial
exercises-scalatutorial copied to clipboard
Suggest using `toList` instead of `to(List)`
As an example, on OSX with Scala version 2.13.1, I see
scala> def average(x: Int, xs: Int*): Double =
| (x :: xs.to(List)).sum.toDouble / (xs.size + 1)
<console>:13: error: type mismatch;
found : scala.collection.immutable.List.type
required: scala.collection.generic.CanBuildFrom[Nothing,Int,?]
(x :: xs.to(List)).sum.toDouble / (xs.size + 1)
^