Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suggest using toList instead of to(List) #98

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

agam
Copy link

@agam agam commented Feb 26, 2020

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)
                   ^

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)
                   ^
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant