Re: Seq :+ repeat parameter
Oliver Ruebenacker <[email protected]> Thu, 7 Apr 2016 08:49:15 -0400
| Newsgroups | gmane.comp.lang.scala |
|---|---|
| Message-ID | <CAA=X4OBV1zB7mha-wiemzuibVBLYkPxOr68XUm408aa_zdL3nQ@mail.gmail.com> |
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
On Thu, Apr 7, 2016 at 8:45 AM, Rich Oliver <[email protected]> wrote:
> I have created the following code and it seems to compile and run
> correctly:
>
> val scaleButs = Seq(CanvButton("+", () => { scale = (scale *
> 1.5).min(scaleMax); repaintMap() }),
> CanvButton("-", () => { scale = (scale / 1.5).max(scaleMin);
> repaintMap() }))
> val mapButs = scaleButs :+ (
> CanvButton("<=", () => { mapFocus = mapFocus.subX(moveInc);
> repaintMap() }),
> CanvButton("=>", () => { mapFocus = mapFocus.addX(moveInc);
> repaintMap() }),
> CanvButton("Up", () => { mapFocus = mapFocus.addY(moveInc);
> repaintMap() }),
> CanvButton("down", () => { mapFocus = mapFocus.subY(moveInc);
> repaintMap() })
> )
>
> But in the API documentation the :+ doesn't have a repeat parameter. I've
> looked in SeqLike.scala
> https://github.com/scala/scala/blob/v2.11.8/src/library/scala/collection/SeqLike.scala#L1
> and I can't see any repeat parameter for the :+ method there either.
>
> --
> 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.
>
--
Oliver Ruebenacker
Senior Software Engineer, Diabetes Portal
<http://www.type2diabetesgenetics.org/>, Broad Institute
<http://www.broadinstitute.org/>
--
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.