Skip to content

Commit

Permalink
Updated SyntacticConveniences.scala (#129)
Browse files Browse the repository at this point in the history
toList method was not properly written.
  • Loading branch information
batakpout committed Jun 19, 2020
1 parent 7c209f9 commit 94f19a6
Showing 1 changed file with 1 addition and 1 deletion.
Expand Up @@ -353,7 +353,7 @@ object SyntacticConveniences extends ScalaTutorialSection {
*/
def repeatedParameters(res0: Double): Unit = {
def average(x: Int, xs: Int*): Double =
(x :: xs.to(List)).sum.toDouble / (xs.size + 1)
(x :: xs.toList).sum.toDouble / (xs.size + 1)

average(1) shouldBe 1.0
average(1, 2) shouldBe 1.5
Expand Down

0 comments on commit 94f19a6

Please sign in to comment.