Re: Seq :+ repeat parameter
Naftoli Gugenheim <[email protected]> Thu, 07 Apr 2016 20:55:53 +0000
| Newsgroups | gmane.comp.lang.scala |
|---|---|
| Message-ID | <CANpg8PCioyUERG5WraOqr+_daCbUk0bu=nrHW2wDCirHOqP9Gw@mail.gmail.com> |
On Thu, Apr 7, 2016, 9:29 AM Rich Oliver <[email protected]> wrote: > On Thursday, 7 April 2016 13:49:18 UTC+1, Oliver Ruebenacker wrote: >> >> >> Hello, >> >> Is it possible that your code does not do what one might think it does? >> >> scala> val seq = Seq(1, 2, 3) >> seq: Seq[Int] = List(1, 2, 3) >> >> scala> val seq2 = seq :+ (4, 5, 6) >> seq2: Seq[Any] = List(1, 2, 3, (4,5,6)) >> >> Best, Oliver >> > > Hi yes you're right. I was forgetting Scala's insanely hyperactive type > inference. > What is insane or hyperactive about this, and what does it have to do with type inference? You wrote the append operator and a tuple, dunno why you didn't see that, but no need to blame Scala. Why not use the ++ operator? Well at least I'm not alone, it drove Paul Phillips to despair. Will this > madness get worse with type unions? > > -- > You received this message because you are subscribed to the Google Groups > "scala-language" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "scala-language" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.