Re: Sorted structures lose their ordering when mapped
Tobin Yehle <[email protected]> Tue, 29 Nov 2016 20:23:01 +0000
| Newsgroups | gmane.comp.lang.scala |
|---|---|
| Message-ID | <CABx_kgSRYR597t3hqgf2NG40t0SRRWPQLH278sM8GoPC=USaUg@mail.gmail.com> |
--001a114a7ede8776df0542765ba8 Content-Type: text/plain; charset=UTF-8 I think the least surprising behavior would be to treat them as the same, but I'm not sure I follow you exactly. Won't a CanBuildFrom[Sorted[K, _], K, Sorted[K, _]] work if it is scope? On Tue, Nov 29, 2016 at 8:16 AM Oliver Ruebenacker <[email protected]> wrote: > > Hello, > > The original ordering can only be kept if the new collection has the > same type of elements. That means your suggestion would split mapping into > two cases - same type or not same type - with different behaviors for each > case. That would certainly complicate things. > > For example, what happens when we don't know whether the type is the > same due to type parameters? Would we treat them as different? > > Best, Oliver > > > > > > On Tue, Nov 29, 2016 at 1:23 AM, Tobin Yehle <[email protected]> wrote: > > On the immutable side, I think the only concrete collections that inherit > from SortedSet are TreeSet and BitSet. I think the problem also exists in > TreeMap, and all the mutable versions of these three structures. Mutable > BitSets are probably the largest use case. > > Use cases for TreeSet and TreeMap are for situations where a HashSet/Map > would be good, but in-order traversals are also needed. They provide Log > insertions/deletions/lookups. > > My thought is that sorted collections should retain their ordering > whenever possible. > > scala> val set = SortedSet(1,2,3)(ord=Ordering.Int.reverse) > set: scala.collection.SortedSet[Int] = TreeSet(3, 2, 1) > > scala> set.map(identity) > res0: scala.collection.SortedSet[Int] = TreeSet(1, 2, 3) should > be TreeSet(3, 2, 1)? > > scala> set.map(_*2) > res1: scala.collection.SortedSet[Int] = TreeSet(2, 4, 6) should be > TreeSet(6, 4, 2)? > > and if possible > > scala> set.map(_*2)(collection.breakOut) : BitSet > res2: scala.collection.BitSet = BitSet(2, 4, 6) > should be BitSet(6, 4, 2)? > > an impossible case is when the type of the objects in the container changes > > scala> set.map("a" * _) > res3: scala.collection.SortedSet[String] = TreeSet(a, aa, aaa) this > seems like correct behavior > > > On Mon, Nov 28, 2016 at 10:34 PM Vlad Patryshev <[email protected]> > wrote: > > It was a pretty nice (counter-)example, but I wonder what is "SortedSet"? > And of course the next question will be - how should map be defined on > "SortedSet"? > > It's not a joke, it's a serious question. > > Thanks, > -Vlad > > On Mon, Nov 28, 2016 at 8:14 PM, Tobin Yehle <[email protected]> wrote: > > Not sure if I'm really posting this in the right place, but: > > Calling map on a collection that requires an implicit ordering results in > some surprising behavior. For example: > > scala> val set = SortedSet(1,2,3)(ord=Ordering.Int.reverse) > set: scala.collection.SortedSet[Int] = TreeSet(3, 2, 1) > > > scala> set.firstKey == set.map(identity).firstKey > res0: Boolean = false > > My feeling is that mapping the identity function over any collection > should not change anything. > > In this case it is clear what is happening. The CanBuildFrom provided by > SortedSet is pulling an Ordering instance out of predef (Ordering.Int) > instead of using the ordering from the origin collection. > scala> set.toList > res1: List[Int] = List(3, 2, 1) > > > scala> set.map(identity).toList > res2: List[Int] = List(1, 2, 3) > > scala> set.ordering > res3: Ordering[Int] = scala.math.Ordering$$anon$4@3ff3275b > > scala> set.map(identity).ordering > res4: Ordering[Int] = scala.math.Ordering$Int$@7fa85a55 > > I think this can be fixed by providing a more specific CanBuildFrom > instance to be used when mapping between two sorted collections that > contain the same type. > > i.e. Provide a CanBuildFrom[Sorted[K, _], K, Sorted[K, _]] somewhere that > has precedence over the more generic usual CanBuildFrom[CC[_], A, CC[A]] > > I'm not sure how it could be done, but the static overloading resolution > rules make this possible, I think. > > -- > 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 a topic in the > Google Groups "scala-language" group. > To unsubscribe from this topic, visit > https://groups.google.com/d/topic/scala-language/Q5A1TTEZN4Q/unsubscribe. > To unsubscribe from this group and all its topics, 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. > > > > > -- > 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 a topic in the > Google Groups "scala-language" group. > To unsubscribe from this topic, visit > https://groups.google.com/d/topic/scala-language/Q5A1TTEZN4Q/unsubscribe. > To unsubscribe from this group and all its topics, 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. --001a114a7ede8776df0542765ba8 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable <div dir=3D"ltr"><div>I think the least surprising behavior would be to tre= at them as the same, but I'm not sure I follow you exactly. Won't a= =C2=A0<span style=3D"color:rgb(33,33,33)">CanBuildFrom[Sorted[K, _], K, Sor= ted[K, _]] work if it is scope?</span></div></div><br><div class=3D"gmail_q= uote"><div dir=3D"ltr">On Tue, Nov 29, 2016 at 8:16 AM Oliver Ruebenacker &= lt;<a href=3D"mailto:[email protected]">[email protected]</a>> wrote:<br><= /div><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-le= ft:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr" class=3D"gmail_msg"><d= iv class=3D"gmail_msg"><div class=3D"gmail_msg"><div class=3D"gmail_msg"><d= iv class=3D"gmail_msg"><br class=3D"gmail_msg"></div>=C2=A0=C2=A0=C2=A0=C2= =A0 Hello,<br class=3D"gmail_msg"><br class=3D"gmail_msg"></div>=C2=A0 The = original ordering can only be kept if the new collection has the same type = of elements. That means your suggestion would split mapping into two cases = - same type or not same type - with different behaviors for each case. That= would certainly complicate things.<br class=3D"gmail_msg"><br class=3D"gma= il_msg"></div>=C2=A0 For example, what happens when we don't know wheth= er the type is the same due to type parameters? Would we treat them as diff= erent?<br class=3D"gmail_msg"><br class=3D"gmail_msg"></div><div class=3D"g= mail_msg">=C2=A0=C2=A0=C2=A0=C2=A0 Best, Oliver<br class=3D"gmail_msg"></di= v><div class=3D"gmail_msg"><br class=3D"gmail_msg"><br class=3D"gmail_msg">= </div><div class=3D"gmail_msg"><br class=3D"gmail_msg">=C2=A0 <br class=3D"= gmail_msg"></div></div><div class=3D"gmail_extra gmail_msg"></div><div clas= s=3D"gmail_extra gmail_msg"><br class=3D"gmail_msg"><div class=3D"gmail_quo= te gmail_msg">On Tue, Nov 29, 2016 at 1:23 AM, Tobin Yehle <span dir=3D"ltr= " class=3D"gmail_msg"><<a href=3D"mailto:[email protected]" class=3D"= gmail_msg" target=3D"_blank">[email protected]</a>></span> wrote:<br = class=3D"gmail_msg"><blockquote class=3D"gmail_quote gmail_msg" style=3D"ma= rgin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir=3D"lt= r" class=3D"gmail_msg">On the immutable side, I think the only concrete col= lections that inherit from SortedSet are TreeSet and BitSet. I think the pr= oblem also exists in TreeMap, and all the mutable versions of these three s= tructures. Mutable BitSets are probably the largest use case.<div class=3D"= gmail_msg"><br class=3D"gmail_msg"></div><div class=3D"gmail_msg">Use cases= for TreeSet and TreeMap are for situations where a HashSet/Map would be go= od, but in-order traversals are also needed. They provide Log insertions/de= letions/lookups.</div><div class=3D"gmail_msg"><br class=3D"gmail_msg"></di= v><div class=3D"gmail_msg">My thought is that sorted collections should ret= ain their ordering whenever possible.</div><div class=3D"gmail_msg"><br cla= ss=3D"gmail_msg"></div><div class=3D"gmail_msg"><span class=3D"gmail_msg"><= div class=3D"gmail_msg">scala> val set =3D SortedSet(1,2,3)(ord=3DOrderi= ng.Int.reverse)</div><div class=3D"gmail_msg">set: scala.collection.SortedS= et[Int] =3D TreeSet(3, 2, 1)</div><div class=3D"gmail_msg"><br class=3D"gma= il_msg"></div></span><div class=3D"gmail_msg">scala> set.map(identity)</= div><div class=3D"gmail_msg">res0: scala.collection.SortedSet[Int] =3D Tree= Set(1, 2, 3) =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0should be TreeSet(3, 2, 1)?<= /div><div class=3D"gmail_msg"><br class=3D"gmail_msg"></div><div class=3D"g= mail_msg">scala> set.map(_*2)</div><div class=3D"gmail_msg">res1: scala.= collection.SortedSet[Int] =3D TreeSet(2, 4, 6) =C2=A0 =C2=A0 =C2=A0 =C2=A0 = should be TreeSet(6, 4, 2)?</div></div><div class=3D"gmail_msg"><br class= =3D"gmail_msg"></div><div class=3D"gmail_msg">and if possible</div><div cla= ss=3D"gmail_msg"><br class=3D"gmail_msg"></div><div class=3D"gmail_msg"><di= v class=3D"gmail_msg">scala> set.map(_*2)(collection.breakOut) : BitSet<= /div><div class=3D"gmail_msg">res2: scala.collection.BitSet =3D BitSet(2, 4= , 6) =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0should be BitSet(6, 4, 2)?</div></div><div class=3D"gmail_msg"= ><br class=3D"gmail_msg"></div><div class=3D"gmail_msg">an impossible case = is when the type of the objects in the container changes</div><div class=3D= "gmail_msg"><br class=3D"gmail_msg"></div><div class=3D"gmail_msg"><div cla= ss=3D"gmail_msg">scala> set.map("a" * _)</div><div class=3D"gm= ail_msg">res3: scala.collection.SortedSet[String] =3D TreeSet(a, aa, aaa) = =C2=A0 =C2=A0 =C2=A0 =C2=A0this seems like correct behavior</div></div><div= class=3D"gmail_msg"><br class=3D"gmail_msg"></div></div><br class=3D"gmail= _msg"><div class=3D"gmail_quote gmail_msg"><div class=3D"gmail_msg"><div cl= ass=3D"m_4561654010907287049h5 gmail_msg"><div dir=3D"ltr" class=3D"gmail_m= sg">On Mon, Nov 28, 2016 at 10:34 PM Vlad Patryshev <<a href=3D"mailto:v= [email protected]" class=3D"gmail_msg" target=3D"_blank">vpatryshev@gmail= .com</a>> wrote:<br class=3D"gmail_msg"></div></div></div><blockquote cl= ass=3D"gmail_quote gmail_msg" style=3D"margin:0 0 0 .8ex;border-left:1px #c= cc solid;padding-left:1ex"><div class=3D"gmail_msg"><div class=3D"m_4561654= 010907287049h5 gmail_msg"><div dir=3D"ltr" class=3D"m_4561654010907287049m_= -4798312560682989803gmail_msg gmail_msg">It was a pretty nice (counter-)exa= mple, but I wonder what is "SortedSet"? And of course the next qu= estion will be - how should map be defined on "SortedSet"?<div cl= ass=3D"m_4561654010907287049m_-4798312560682989803gmail_msg gmail_msg"><br = class=3D"m_4561654010907287049m_-4798312560682989803gmail_msg gmail_msg"></= div><div class=3D"m_4561654010907287049m_-4798312560682989803gmail_msg gmai= l_msg">It's not a joke, it's a serious question.</div></div><div cl= ass=3D"gmail_extra m_4561654010907287049m_-4798312560682989803gmail_msg gma= il_msg"><br class=3D"m_4561654010907287049m_-4798312560682989803gmail_msg g= mail_msg" clear=3D"all"><div class=3D"m_4561654010907287049m_-4798312560682= 989803gmail_msg gmail_msg"><div class=3D"m_4561654010907287049m_-4798312560= 682989803m_-5042556665519706739gmail_signature m_4561654010907287049m_-4798= 312560682989803gmail_msg gmail_msg" data-smartmail=3D"gmail_signature">Than= ks,<br class=3D"m_4561654010907287049m_-4798312560682989803gmail_msg gmail_= msg">-Vlad</div></div> <br class=3D"m_4561654010907287049m_-4798312560682989803gmail_msg gmail_msg= "><div class=3D"gmail_quote m_4561654010907287049m_-4798312560682989803gmai= l_msg gmail_msg"></div></div><div class=3D"gmail_extra m_456165401090728704= 9m_-4798312560682989803gmail_msg gmail_msg"><div class=3D"gmail_quote m_456= 1654010907287049m_-4798312560682989803gmail_msg gmail_msg">On Mon, Nov 28, = 2016 at 8:14 PM, Tobin Yehle <span dir=3D"ltr" class=3D"m_45616540109072870= 49m_-4798312560682989803gmail_msg gmail_msg"><<a href=3D"mailto:tobinyeh= [email protected]" class=3D"m_4561654010907287049m_-4798312560682989803gmail_msg= gmail_msg" target=3D"_blank">[email protected]</a>></span> wrote:<br= class=3D"m_4561654010907287049m_-4798312560682989803gmail_msg gmail_msg"><= /div></div><div class=3D"gmail_extra m_4561654010907287049m_-47983125606829= 89803gmail_msg gmail_msg"><div class=3D"gmail_quote m_4561654010907287049m_= -4798312560682989803gmail_msg gmail_msg"><blockquote class=3D"gmail_quote m= _4561654010907287049m_-4798312560682989803gmail_msg gmail_msg" style=3D"mar= gin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr= " class=3D"m_4561654010907287049m_-4798312560682989803gmail_msg gmail_msg">= <div class=3D"m_4561654010907287049m_-4798312560682989803gmail_msg gmail_ms= g">Not sure if I'm really posting this in the right place, but:</div><d= iv class=3D"m_4561654010907287049m_-4798312560682989803gmail_msg gmail_msg"= ><br class=3D"m_4561654010907287049m_-4798312560682989803gmail_msg gmail_ms= g"></div>Calling map on a collection that requires an implicit ordering res= ults in some surprising behavior. For example:<div class=3D"m_4561654010907= 287049m_-4798312560682989803gmail_msg gmail_msg"><div class=3D"m_4561654010= 907287049m_-4798312560682989803gmail_msg gmail_msg"><br class=3D"m_45616540= 10907287049m_-4798312560682989803gmail_msg gmail_msg"></div><div class=3D"m= _4561654010907287049m_-4798312560682989803m_-5042556665519706739m_344026996= 5916649927prettyprint m_4561654010907287049m_-4798312560682989803gmail_msg = gmail_msg" style=3D"background-color:rgb(250,250,250);border-color:rgb(187,= 187,187);border-style:solid;border-width:1px;word-wrap:break-word"><code cl= ass=3D"m_4561654010907287049m_-4798312560682989803m_-5042556665519706739m_3= 440269965916649927prettyprint m_4561654010907287049m_-4798312560682989803gm= ail_msg gmail_msg"><div class=3D"m_4561654010907287049m_-479831256068298980= 3m_-5042556665519706739m_3440269965916649927subprettyprint m_45616540109072= 87049m_-4798312560682989803gmail_msg gmail_msg"><span style=3D"color:#000" = class=3D"m_4561654010907287049m_-4798312560682989803m_-5042556665519706739m= _3440269965916649927styled-by-prettify m_4561654010907287049m_-479831256068= 2989803gmail_msg gmail_msg">scala</span><span style=3D"color:#660" class=3D= "m_4561654010907287049m_-4798312560682989803m_-5042556665519706739m_3440269= 965916649927styled-by-prettify m_4561654010907287049m_-4798312560682989803g= mail_msg gmail_msg">></span><span style=3D"color:#000" class=3D"m_456165= 4010907287049m_-4798312560682989803m_-5042556665519706739m_3440269965916649= 927styled-by-prettify m_4561654010907287049m_-4798312560682989803gmail_msg = gmail_msg"> val </span><span style=3D"color:#008" class=3D"m_45616540109072= 87049m_-4798312560682989803m_-5042556665519706739m_3440269965916649927style= d-by-prettify m_4561654010907287049m_-4798312560682989803gmail_msg gmail_ms= g">set</span><span style=3D"color:#000" class=3D"m_4561654010907287049m_-47= 98312560682989803m_-5042556665519706739m_3440269965916649927styled-by-prett= ify m_4561654010907287049m_-4798312560682989803gmail_msg gmail_msg"> </span= ><span style=3D"color:#660" class=3D"m_4561654010907287049m_-47983125606829= 89803m_-5042556665519706739m_3440269965916649927styled-by-prettify m_456165= 4010907287049m_-4798312560682989803gmail_msg gmail_msg">=3D</span><span sty= le=3D"color:#000" class=3D"m_4561654010907287049m_-4798312560682989803m_-50= 42556665519706739m_3440269965916649927styled-by-prettify m_4561654010907287= 049m_-4798312560682989803gmail_msg gmail_msg"> </span><span style=3D"color:= #606" class=3D"m_4561654010907287049m_-4798312560682989803m_-50425566655197= 06739m_3440269965916649927styled-by-prettify m_4561654010907287049m_-479831= 2560682989803gmail_msg gmail_msg">SortedSet</span><span style=3D"color:#660= " class=3D"m_4561654010907287049m_-4798312560682989803m_-504255666551970673= 9m_3440269965916649927styled-by-prettify m_4561654010907287049m_-4798312560= 682989803gmail_msg gmail_msg">(</span><span style=3D"color:#066" class=3D"m= _4561654010907287049m_-4798312560682989803m_-5042556665519706739m_344026996= 5916649927styled-by-prettify m_4561654010907287049m_-4798312560682989803gma= il_msg gmail_msg">1</span><span style=3D"color:#660" class=3D"m_45616540109= 07287049m_-4798312560682989803m_-5042556665519706739m_3440269965916649927st= yled-by-prettify m_4561654010907287049m_-4798312560682989803gmail_msg gmail= _msg">,</span><span style=3D"color:#066" class=3D"m_4561654010907287049m_-4= 798312560682989803m_-5042556665519706739m_3440269965916649927styled-by-pret= tify m_4561654010907287049m_-4798312560682989803gmail_msg gmail_msg">2</spa= n><span style=3D"color:#660" class=3D"m_4561654010907287049m_-4798312560682= 989803m_-5042556665519706739m_3440269965916649927styled-by-prettify m_45616= 54010907287049m_-4798312560682989803gmail_msg gmail_msg">,</span><span styl= e=3D"color:#066" class=3D"m_4561654010907287049m_-4798312560682989803m_-504= 2556665519706739m_3440269965916649927styled-by-prettify m_45616540109072870= 49m_-4798312560682989803gmail_msg gmail_msg">3</span><span style=3D"color:#= 660" class=3D"m_4561654010907287049m_-4798312560682989803m_-504255666551970= 6739m_3440269965916649927styled-by-prettify m_4561654010907287049m_-4798312= 560682989803gmail_msg gmail_msg">)(</span><span style=3D"color:#000" class= =3D"m_4561654010907287049m_-4798312560682989803m_-5042556665519706739m_3440= 269965916649927styled-by-prettify m_4561654010907287049m_-47983125606829898= 03gmail_msg gmail_msg">ord</span><span style=3D"color:#660" class=3D"m_4561= 654010907287049m_-4798312560682989803m_-5042556665519706739m_34402699659166= 49927styled-by-prettify m_4561654010907287049m_-4798312560682989803gmail_ms= g gmail_msg">=3D</span><span style=3D"color:#606" class=3D"m_45616540109072= 87049m_-4798312560682989803m_-5042556665519706739m_3440269965916649927style= d-by-prettify m_4561654010907287049m_-4798312560682989803gmail_msg gmail_ms= g">Ordering</span><span style=3D"color:#660" class=3D"m_4561654010907287049= m_-4798312560682989803m_-5042556665519706739m_3440269965916649927styled-by-= prettify m_4561654010907287049m_-4798312560682989803gmail_msg gmail_msg">.<= /span><span style=3D"color:#606" class=3D"m_4561654010907287049m_-479831256= 0682989803m_-5042556665519706739m_3440269965916649927styled-by-prettify m_4= 561654010907287049m_-4798312560682989803gmail_msg gmail_msg">Int</span><spa= n style=3D"color:#660" class=3D"m_4561654010907287049m_-4798312560682989803= m_-5042556665519706739m_3440269965916649927styled-by-prettify m_45616540109= 07287049m_-4798312560682989803gmail_msg gmail_msg">.</span><span style=3D"c= olor:#000" class=3D"m_4561654010907287049m_-4798312560682989803m_-504255666= 5519706739m_3440269965916649927styled-by-prettify m_4561654010907287049m_-4= 798312560682989803gmail_msg gmail_msg">reverse</span><span style=3D"color:#= 660" class=3D"m_4561654010907287049m_-4798312560682989803m_-504255666551970= 6739m_3440269965916649927styled-by-prettify m_4561654010907287049m_-4798312= 560682989803gmail_msg gmail_msg">)</span><span style=3D"color:#000" class= =3D"m_4561654010907287049m_-4798312560682989803m_-5042556665519706739m_3440= 269965916649927styled-by-prettify m_4561654010907287049m_-47983125606829898= 03gmail_msg gmail_msg"><br class=3D"m_4561654010907287049m_-479831256068298= 9803gmail_msg gmail_msg"></span><span style=3D"color:#008" class=3D"m_45616= 54010907287049m_-4798312560682989803m_-5042556665519706739m_344026996591664= 9927styled-by-prettify m_4561654010907287049m_-4798312560682989803gmail_msg= gmail_msg">set</span><span style=3D"color:#660" class=3D"m_456165401090728= 7049m_-4798312560682989803m_-5042556665519706739m_3440269965916649927styled= -by-prettify m_4561654010907287049m_-4798312560682989803gmail_msg gmail_msg= ">:</span><span style=3D"color:#000" class=3D"m_4561654010907287049m_-47983= 12560682989803m_-5042556665519706739m_3440269965916649927styled-by-prettify= m_4561654010907287049m_-4798312560682989803gmail_msg gmail_msg"> scala</sp= an><span style=3D"color:#660" class=3D"m_4561654010907287049m_-479831256068= 2989803m_-5042556665519706739m_3440269965916649927styled-by-prettify m_4561= 654010907287049m_-4798312560682989803gmail_msg gmail_msg">.</span><span sty= le=3D"color:#000" class=3D"m_4561654010907287049m_-4798312560682989803m_-50= 42556665519706739m_3440269965916649927styled-by-prettify m_4561654010907287= 049m_-4798312560682989803gmail_msg gmail_msg">collection</span><span style= =3D"color:#660" class=3D"m_4561654010907287049m_-4798312560682989803m_-5042= 556665519706739m_3440269965916649927styled-by-prettify m_456165401090728704= 9m_-4798312560682989803gmail_msg gmail_msg">.</span><span style=3D"color:#6= 06" class=3D"m_4561654010907287049m_-4798312560682989803m_-5042556665519706= 739m_3440269965916649927styled-by-prettify m_4561654010907287049m_-47983125= 60682989803gmail_msg gmail_msg">SortedSet</span><span style=3D"color:#660" = class=3D"m_4561654010907287049m_-4798312560682989803m_-5042556665519706739m= _3440269965916649927styled-by-prettify m_4561654010907287049m_-479831256068= 2989803gmail_msg gmail_msg">[</span><span style=3D"color:#606" class=3D"m_4= 561654010907287049m_-4798312560682989803m_-5042556665519706739m_34402699659= 16649927styled-by-prettify m_4561654010907287049m_-4798312560682989803gmail= _msg gmail_msg">Int</span><span style=3D"color:#660" class=3D"m_45616540109= 07287049m_-4798312560682989803m_-5042556665519706739m_3440269965916649927st= yled-by-prettify m_4561654010907287049m_-4798312560682989803gmail_msg gmail= _msg">]</span><span style=3D"color:#000" class=3D"m_4561654010907287049m_-4= 798312560682989803m_-5042556665519706739m_3440269965916649927styled-by-pret= tify m_4561654010907287049m_-4798312560682989803gmail_msg gmail_msg"> </spa= n><span style=3D"color:#660" class=3D"m_4561654010907287049m_-4798312560682= 989803m_-5042556665519706739m_3440269965916649927styled-by-prettify m_45616= 54010907287049m_-4798312560682989803gmail_msg gmail_msg">=3D</span><span st= yle=3D"color:#000" class=3D"m_4561654010907287049m_-4798312560682989803m_-5= 042556665519706739m_3440269965916649927styled-by-prettify m_456165401090728= 7049m_-4798312560682989803gmail_msg gmail_msg"> </span><span style=3D"color= :#606" class=3D"m_4561654010907287049m_-4798312560682989803m_-5042556665519= 706739m_3440269965916649927styled-by-prettify m_4561654010907287049m_-47983= 12560682989803gmail_msg gmail_msg">TreeSet</span><span style=3D"color:#660"= class=3D"m_4561654010907287049m_-4798312560682989803m_-5042556665519706739= m_3440269965916649927styled-by-prettify m_4561654010907287049m_-47983125606= 82989803gmail_msg gmail_msg">(</span><span style=3D"color:#066" class=3D"m_= 4561654010907287049m_-4798312560682989803m_-5042556665519706739m_3440269965= 916649927styled-by-prettify m_4561654010907287049m_-4798312560682989803gmai= l_msg gmail_msg">3</span><span style=3D"color:#660" class=3D"m_456165401090= 7287049m_-4798312560682989803m_-5042556665519706739m_3440269965916649927sty= led-by-prettify m_4561654010907287049m_-4798312560682989803gmail_msg gmail_= msg">,</span><span style=3D"color:#000" class=3D"m_4561654010907287049m_-47= 98312560682989803m_-5042556665519706739m_3440269965916649927styled-by-prett= ify m_4561654010907287049m_-4798312560682989803gmail_msg gmail_msg"> </span= ><span style=3D"color:#066" class=3D"m_4561654010907287049m_-47983125606829= 89803m_-5042556665519706739m_3440269965916649927styled-by-prettify m_456165= 4010907287049m_-4798312560682989803gmail_msg gmail_msg">2</span><span style= =3D"color:#660" class=3D"m_4561654010907287049m_-4798312560682989803m_-5042= 556665519706739m_3440269965916649927styled-by-prettify m_456165401090728704= 9m_-4798312560682989803gmail_msg gmail_msg">,</span><span style=3D"color:#0= 00" class=3D"m_4561654010907287049m_-4798312560682989803m_-5042556665519706= 739m_3440269965916649927styled-by-prettify m_4561654010907287049m_-47983125= 60682989803gmail_msg gmail_msg"> </span><span style=3D"color:#066" class=3D= "m_4561654010907287049m_-4798312560682989803m_-5042556665519706739m_3440269= 965916649927styled-by-prettify m_4561654010907287049m_-4798312560682989803g= mail_msg gmail_msg">1</span><span style=3D"color:#660" class=3D"m_456165401= 0907287049m_-4798312560682989803m_-5042556665519706739m_3440269965916649927= styled-by-prettify m_4561654010907287049m_-4798312560682989803gmail_msg gma= il_msg">)</span><span style=3D"color:#000" class=3D"m_4561654010907287049m_= -4798312560682989803m_-5042556665519706739m_3440269965916649927styled-by-pr= ettify m_4561654010907287049m_-4798312560682989803gmail_msg gmail_msg"><br = class=3D"m_4561654010907287049m_-4798312560682989803gmail_msg gmail_msg"><b= r class=3D"m_4561654010907287049m_-4798312560682989803gmail_msg gmail_msg">= <br class=3D"m_4561654010907287049m_-4798312560682989803gmail_msg gmail_msg= ">scala</span><span style=3D"color:#660" class=3D"m_4561654010907287049m_-4= 798312560682989803m_-5042556665519706739m_3440269965916649927styled-by-pret= tify m_4561654010907287049m_-4798312560682989803gmail_msg gmail_msg">></= span><span style=3D"color:#000" class=3D"m_4561654010907287049m_-4798312560= 682989803m_-5042556665519706739m_3440269965916649927styled-by-prettify m_45= 61654010907287049m_-4798312560682989803gmail_msg gmail_msg"> </span><span s= tyle=3D"color:#008" class=3D"m_4561654010907287049m_-4798312560682989803m_-= 5042556665519706739m_3440269965916649927styled-by-prettify m_45616540109072= 87049m_-4798312560682989803gmail_msg gmail_msg">set</span><span style=3D"co= lor:#660" class=3D"m_4561654010907287049m_-4798312560682989803m_-5042556665= 519706739m_3440269965916649927styled-by-prettify m_4561654010907287049m_-47= 98312560682989803gmail_msg gmail_msg">.</span><span style=3D"color:#000" cl= ass=3D"m_4561654010907287049m_-4798312560682989803m_-5042556665519706739m_3= 440269965916649927styled-by-prettify m_4561654010907287049m_-47983125606829= 89803gmail_msg gmail_msg">firstKey </span><span style=3D"color:#660" class= =3D"m_4561654010907287049m_-4798312560682989803m_-5042556665519706739m_3440= 269965916649927styled-by-prettify m_4561654010907287049m_-47983125606829898= 03gmail_msg gmail_msg">=3D=3D</span><span style=3D"color:#000" class=3D"m_4= 561654010907287049m_-4798312560682989803m_-5042556665519706739m_34402699659= 16649927styled-by-prettify m_4561654010907287049m_-4798312560682989803gmail= _msg gmail_msg"> </span><span style=3D"color:#008" class=3D"m_4561654010907= 287049m_-4798312560682989803m_-5042556665519706739m_3440269965916649927styl= ed-by-prettify m_4561654010907287049m_-4798312560682989803gmail_msg gmail_m= sg">set</span><span style=3D"color:#660" class=3D"m_4561654010907287049m_-4= 798312560682989803m_-5042556665519706739m_3440269965916649927styled-by-pret= tify m_4561654010907287049m_-4798312560682989803gmail_msg gmail_msg">.</spa= n><span style=3D"color:#000" class=3D"m_4561654010907287049m_-4798312560682= 989803m_-5042556665519706739m_3440269965916649927styled-by-prettify m_45616= 54010907287049m_-4798312560682989803gmail_msg gmail_msg">map</span><span st= yle=3D"color:#660" class=3D"m_4561654010907287049m_-4798312560682989803m_-5= 042556665519706739m_3440269965916649927styled-by-prettify m_456165401090728= 7049m_-4798312560682989803gmail_msg gmail_msg">(</span><span style=3D"color= :#000" class=3D"m_4561654010907287049m_-4798312560682989803m_-5042556665519= 706739m_3440269965916649927styled-by-prettify m_4561654010907287049m_-47983= 12560682989803gmail_msg gmail_msg">identity</span><span style=3D"color:#660= " class=3D"m_4561654010907287049m_-4798312560682989803m_-504255666551970673= 9m_3440269965916649927styled-by-prettify m_4561654010907287049m_-4798312560= 682989803gmail_msg gmail_msg">).</span><span style=3D"color:#000" class=3D"= m_4561654010907287049m_-4798312560682989803m_-5042556665519706739m_34402699= 65916649927styled-by-prettify m_4561654010907287049m_-4798312560682989803gm= ail_msg gmail_msg">firstKey<br class=3D"m_4561654010907287049m_-47983125606= 82989803gmail_msg gmail_msg">res0</span><span style=3D"color:#660" class=3D= "m_4561654010907287049m_-4798312560682989803m_-5042556665519706739m_3440269= 965916649927styled-by-prettify m_4561654010907287049m_-4798312560682989803g= mail_msg gmail_msg">:</span><span style=3D"color:#000" class=3D"m_456165401= 0907287049m_-4798312560682989803m_-5042556665519706739m_3440269965916649927= styled-by-prettify m_4561654010907287049m_-4798312560682989803gmail_msg gma= il_msg"> </span><span style=3D"color:#606" class=3D"m_4561654010907287049m_= -4798312560682989803m_-5042556665519706739m_3440269965916649927styled-by-pr= ettify m_4561654010907287049m_-4798312560682989803gmail_msg gmail_msg">Bool= ean</span><span style=3D"color:#000" class=3D"m_4561654010907287049m_-47983= 12560682989803m_-5042556665519706739m_3440269965916649927styled-by-prettify= m_4561654010907287049m_-4798312560682989803gmail_msg gmail_msg"> </span><s= pan style=3D"color:#660" class=3D"m_4561654010907287049m_-47983125606829898= 03m_-5042556665519706739m_3440269965916649927styled-by-prettify m_456165401= 0907287049m_-4798312560682989803gmail_msg gmail_msg">=3D</span><span style= =3D"color:#000" class=3D"m_4561654010907287049m_-4798312560682989803m_-5042= 556665519706739m_3440269965916649927styled-by-prettify m_456165401090728704= 9m_-4798312560682989803gmail_msg gmail_msg"> </span><span style=3D"color:#0= 08" class=3D"m_4561654010907287049m_-4798312560682989803m_-5042556665519706= 739m_3440269965916649927styled-by-prettify m_4561654010907287049m_-47983125= 60682989803gmail_msg gmail_msg">false</span></div></code></div><div class= =3D"m_4561654010907287049m_-4798312560682989803gmail_msg gmail_msg"><br cla= ss=3D"m_4561654010907287049m_-4798312560682989803gmail_msg gmail_msg"></div= ></div><div class=3D"m_4561654010907287049m_-4798312560682989803gmail_msg g= mail_msg">My feeling is that mapping the identity function over any collect= ion should not change anything.</div><div class=3D"m_4561654010907287049m_-= 4798312560682989803gmail_msg gmail_msg"><br class=3D"m_4561654010907287049m= _-4798312560682989803gmail_msg gmail_msg"></div><div class=3D"m_45616540109= 07287049m_-4798312560682989803gmail_msg gmail_msg">In this case it is clear= what is happening. The CanBuildFrom provided by SortedSet is pulling an Or= dering instance out of predef (Ordering.Int) instead of using the ordering = from the origin collection.</div><div class=3D"m_4561654010907287049m_-4798= 312560682989803m_-5042556665519706739m_3440269965916649927prettyprint m_456= 1654010907287049m_-4798312560682989803gmail_msg gmail_msg" style=3D"backgro= und-color:rgb(250,250,250);border-color:rgb(187,187,187);border-style:solid= ;border-width:1px;word-wrap:break-word"><code class=3D"m_456165401090728704= 9m_-4798312560682989803m_-5042556665519706739m_3440269965916649927prettypri= nt m_4561654010907287049m_-4798312560682989803gmail_msg gmail_msg"><div cla= ss=3D"m_4561654010907287049m_-4798312560682989803m_-5042556665519706739m_34= 40269965916649927subprettyprint m_4561654010907287049m_-4798312560682989803= gmail_msg gmail_msg"><span style=3D"color:#000" class=3D"m_4561654010907287= 049m_-4798312560682989803m_-5042556665519706739m_3440269965916649927styled-= by-prettify m_4561654010907287049m_-4798312560682989803gmail_msg gmail_msg"= >scala</span><span style=3D"color:#660" class=3D"m_4561654010907287049m_-47= 98312560682989803m_-5042556665519706739m_3440269965916649927styled-by-prett= ify m_4561654010907287049m_-4798312560682989803gmail_msg gmail_msg">></s= pan><span style=3D"color:#000" class=3D"m_4561654010907287049m_-47983125606= 82989803m_-5042556665519706739m_3440269965916649927styled-by-prettify m_456= 1654010907287049m_-4798312560682989803gmail_msg gmail_msg"> </span><span st= yle=3D"color:#008" class=3D"m_4561654010907287049m_-4798312560682989803m_-5= 042556665519706739m_3440269965916649927styled-by-prettify m_456165401090728= 7049m_-4798312560682989803gmail_msg gmail_msg">set</span><span style=3D"col= or:#660" class=3D"m_4561654010907287049m_-4798312560682989803m_-50425566655= 19706739m_3440269965916649927styled-by-prettify m_4561654010907287049m_-479= 8312560682989803gmail_msg gmail_msg">.</span><span style=3D"color:#000" cla= ss=3D"m_4561654010907287049m_-4798312560682989803m_-5042556665519706739m_34= 40269965916649927styled-by-prettify m_4561654010907287049m_-479831256068298= 9803gmail_msg gmail_msg">toList<br class=3D"m_4561654010907287049m_-4798312= 560682989803gmail_msg gmail_msg">res1</span><span style=3D"color:#660" clas= s=3D"m_4561654010907287049m_-4798312560682989803m_-5042556665519706739m_344= 0269965916649927styled-by-prettify m_4561654010907287049m_-4798312560682989= 803gmail_msg gmail_msg">:</span><span style=3D"color:#000" class=3D"m_45616= 54010907287049m_-4798312560682989803m_-5042556665519706739m_344026996591664= 9927styled-by-prettify m_4561654010907287049m_-4798312560682989803gmail_msg= gmail_msg"> </span><span style=3D"color:#606" class=3D"m_45616540109072870= 49m_-4798312560682989803m_-5042556665519706739m_3440269965916649927styled-b= y-prettify m_4561654010907287049m_-4798312560682989803gmail_msg gmail_msg">= List</span><span style=3D"color:#660" class=3D"m_4561654010907287049m_-4798= 312560682989803m_-5042556665519706739m_3440269965916649927styled-by-prettif= y m_4561654010907287049m_-4798312560682989803gmail_msg gmail_msg">[</span><= span style=3D"color:#606" class=3D"m_4561654010907287049m_-4798312560682989= 803m_-5042556665519706739m_3440269965916649927styled-by-prettify m_45616540= 10907287049m_-4798312560682989803gmail_msg gmail_msg">Int</span><span style= =3D"color:#660" class=3D"m_4561654010907287049m_-4798312560682989803m_-5042= 556665519706739m_3440269965916649927styled-by-prettify m_456165401090728704= 9m_-4798312560682989803gmail_msg gmail_msg">]</span><span style=3D"color:#0= 00" class=3D"m_4561654010907287049m_-4798312560682989803m_-5042556665519706= 739m_3440269965916649927styled-by-prettify m_4561654010907287049m_-47983125= 60682989803gmail_msg gmail_msg"> </span><span style=3D"color:#660" class=3D= "m_4561654010907287049m_-4798312560682989803m_-5042556665519706739m_3440269= 965916649927styled-by-prettify m_4561654010907287049m_-4798312560682989803g= mail_msg gmail_msg">=3D</span><span style=3D"color:#000" class=3D"m_4561654= 010907287049m_-4798312560682989803m_-5042556665519706739m_34402699659166499= 27styled-by-prettify m_4561654010907287049m_-4798312560682989803gmail_msg g= mail_msg"> </span><span style=3D"color:#606" class=3D"m_4561654010907287049= m_-4798312560682989803m_-5042556665519706739m_3440269965916649927styled-by-= prettify m_4561654010907287049m_-4798312560682989803gmail_msg gmail_msg">Li= st</span><span style=3D"color:#660" class=3D"m_4561654010907287049m_-479831= 2560682989803m_-5042556665519706739m_3440269965916649927styled-by-prettify = m_4561654010907287049m_-4798312560682989803gmail_msg gmail_msg">(</span><sp= an style=3D"color:#066" class=3D"m_4561654010907287049m_-479831256068298980= 3m_-5042556665519706739m_3440269965916649927styled-by-prettify m_4561654010= 907287049m_-4798312560682989803gmail_msg gmail_msg">3</span><span style=3D"= color:#660" class=3D"m_4561654010907287049m_-4798312560682989803m_-50425566= 65519706739m_3440269965916649927styled-by-prettify m_4561654010907287049m_-= 4798312560682989803gmail_msg gmail_msg">,</span><span style=3D"color:#000" = class=3D"m_4561654010907287049m_-4798312560682989803m_-5042556665519706739m= _3440269965916649927styled-by-prettify m_4561654010907287049m_-479831256068= 2989803gmail_msg gmail_msg"> </span><span style=3D"color:#066" class=3D"m_4= 561654010907287049m_-4798312560682989803m_-5042556665519706739m_34402699659= 16649927styled-by-prettify m_4561654010907287049m_-4798312560682989803gmail= _msg gmail_msg">2</span><span style=3D"color:#660" class=3D"m_4561654010907= 287049m_-4798312560682989803m_-5042556665519706739m_3440269965916649927styl= ed-by-prettify m_4561654010907287049m_-4798312560682989803gmail_msg gmail_m= sg">,</span><span style=3D"color:#000" class=3D"m_4561654010907287049m_-479= 8312560682989803m_-5042556665519706739m_3440269965916649927styled-by-pretti= fy m_4561654010907287049m_-4798312560682989803gmail_msg gmail_msg"> </span>= <span style=3D"color:#066" class=3D"m_4561654010907287049m_-479831256068298= 9803m_-5042556665519706739m_3440269965916649927styled-by-prettify m_4561654= 010907287049m_-4798312560682989803gmail_msg gmail_msg">1</span><span style= =3D"color:#660" class=3D"m_4561654010907287049m_-4798312560682989803m_-5042= 556665519706739m_3440269965916649927styled-by-prettify m_456165401090728704= 9m_-4798312560682989803gmail_msg gmail_msg">)</span><span style=3D"color:#0= 00" class=3D"m_4561654010907287049m_-4798312560682989803m_-5042556665519706= 739m_3440269965916649927styled-by-prettify m_4561654010907287049m_-47983125= 60682989803gmail_msg gmail_msg"><br class=3D"m_4561654010907287049m_-479831= 2560682989803gmail_msg gmail_msg"><br class=3D"m_4561654010907287049m_-4798= 312560682989803gmail_msg gmail_msg"><br class=3D"m_4561654010907287049m_-47= 98312560682989803gmail_msg gmail_msg">scala</span><span style=3D"color:#660= " class=3D"m_4561654010907287049m_-4798312560682989803m_-504255666551970673= 9m_3440269965916649927styled-by-prettify m_4561654010907287049m_-4798312560= 682989803gmail_msg gmail_msg">></span><span style=3D"color:#000" class= =3D"m_4561654010907287049m_-4798312560682989803m_-5042556665519706739m_3440= 269965916649927styled-by-prettify m_4561654010907287049m_-47983125606829898= 03gmail_msg gmail_msg"> </span><span style=3D"color:#008" class=3D"m_456165= 4010907287049m_-4798312560682989803m_-5042556665519706739m_3440269965916649= 927styled-by-prettify m_4561654010907287049m_-4798312560682989803gmail_msg = gmail_msg">set</span><span style=3D"color:#660" class=3D"m_4561654010907287= 049m_-4798312560682989803m_-5042556665519706739m_3440269965916649927styled-= by-prettify m_4561654010907287049m_-4798312560682989803gmail_msg gmail_msg"= >.</span><span style=3D"color:#000" class=3D"m_4561654010907287049m_-479831= 2560682989803m_-5042556665519706739m_3440269965916649927styled-by-prettify = m_4561654010907287049m_-4798312560682989803gmail_msg gmail_msg">map</span><= span style=3D"color:#660" class=3D"m_4561654010907287049m_-4798312560682989= 803m_-5042556665519706739m_3440269965916649927styled-by-prettify m_45616540= 10907287049m_-4798312560682989803gmail_msg gmail_msg">(</span><span style= =3D"color:#000" class=3D"m_4561654010907287049m_-4798312560682989803m_-5042= 556665519706739m_3440269965916649927styled-by-prettify m_456165401090728704= 9m_-4798312560682989803gmail_msg gmail_msg">identity</span><span style=3D"c= olor:#660" class=3D"m_4561654010907287049m_-4798312560682989803m_-504255666= 5519706739m_3440269965916649927styled-by-prettify m_4561654010907287049m_-4= 798312560682989803gmail_msg gmail_msg">).</span><span style=3D"color:#000" = class=3D"m_4561654010907287049m_-4798312560682989803m_-5042556665519706739m= _3440269965916649927styled-by-prettify m_4561654010907287049m_-479831256068= 2989803gmail_msg gmail_msg">toList<br class=3D"m_4561654010907287049m_-4798= 312560682989803gmail_msg gmail_msg">res2</span><span style=3D"color:#660" c= lass=3D"m_4561654010907287049m_-4798312560682989803m_-5042556665519706739m_= 3440269965916649927styled-by-prettify m_4561654010907287049m_-4798312560682= 989803gmail_msg gmail_msg">:</span><span style=3D"color:#000" class=3D"m_45= 61654010907287049m_-4798312560682989803m_-5042556665519706739m_344026996591= 6649927styled-by-prettify m_4561654010907287049m_-4798312560682989803gmail_= msg gmail_msg"> </span><span style=3D"color:#606" class=3D"m_45616540109072= 87049m_-4798312560682989803m_-5042556665519706739m_3440269965916649927style= d-by-prettify m_4561654010907287049m_-4798312560682989803gmail_msg gmail_ms= g">List</span><span style=3D"color:#660" class=3D"m_4561654010907287049m_-4= 798312560682989803m_-5042556665519706739m_3440269965916649927styled-by-pret= tify m_4561654010907287049m_-4798312560682989803gmail_msg gmail_msg">[</spa= n><span style=3D"color:#606" class=3D"m_4561654010907287049m_-4798312560682= 989803m_-5042556665519706739m_3440269965916649927styled-by-prettify m_45616= 54010907287049m_-4798312560682989803gmail_msg gmail_msg">Int</span><span st= yle=3D"color:#660" class=3D"m_4561654010907287049m_-4798312560682989803m_-5= 042556665519706739m_3440269965916649927styled-by-prettify m_456165401090728= 7049m_-4798312560682989803gmail_msg gmail_msg">]</span><span style=3D"color= :#000" class=3D"m_4561654010907287049m_-4798312560682989803m_-5042556665519= 706739m_3440269965916649927styled-by-prettify m_4561654010907287049m_-47983= 12560682989803gmail_msg gmail_msg"> </span><span style=3D"color:#660" class= =3D"m_4561654010907287049m_-4798312560682989803m_-5042556665519706739m_3440= 269965916649927styled-by-prettify m_4561654010907287049m_-47983125606829898= 03gmail_msg gmail_msg">=3D</span><span style=3D"color:#000" class=3D"m_4561= 654010907287049m_-4798312560682989803m_-5042556665519706739m_34402699659166= 49927styled-by-prettify m_4561654010907287049m_-4798312560682989803gmail_ms= g gmail_msg"> </span><span style=3D"color:#606" class=3D"m_4561654010907287= 049m_-4798312560682989803m_-5042556665519706739m_3440269965916649927styled-= by-prettify m_4561654010907287049m_-4798312560682989803gmail_msg gmail_msg"= >List</span><span style=3D"color:#660" class=3D"m_4561654010907287049m_-479= 8312560682989803m_-5042556665519706739m_3440269965916649927styled-by-pretti= fy m_4561654010907287049m_-4798312560682989803gmail_msg gmail_msg">(</span>= <span style=3D"color:#066" class=3D"m_4561654010907287049m_-479831256068298= 9803m_-5042556665519706739m_3440269965916649927styled-by-prettify m_4561654= 010907287049m_-4798312560682989803gmail_msg gmail_msg">1</span><span style= =3D"color:#660" class=3D"m_4561654010907287049m_-4798312560682989803m_-5042= 556665519706739m_3440269965916649927styled-by-prettify m_456165401090728704= 9m_-4798312560682989803gmail_msg gmail_msg">,</span><span style=3D"color:#0= 00" class=3D"m_4561654010907287049m_-4798312560682989803m_-5042556665519706= 739m_3440269965916649927styled-by-prettify m_4561654010907287049m_-47983125= 60682989803gmail_msg gmail_msg"> </span><span style=3D"color:#066" class=3D= "m_4561654010907287049m_-4798312560682989803m_-5042556665519706739m_3440269= 965916649927styled-by-prettify m_4561654010907287049m_-4798312560682989803g= mail_msg gmail_msg">2</span><span style=3D"color:#660" class=3D"m_456165401= 0907287049m_-4798312560682989803m_-5042556665519706739m_3440269965916649927= styled-by-prettify m_4561654010907287049m_-4798312560682989803gmail_msg gma= il_msg">,</span><span style=3D"color:#000" class=3D"m_4561654010907287049m_= -4798312560682989803m_-5042556665519706739m_3440269965916649927styled-by-pr= ettify m_4561654010907287049m_-4798312560682989803gmail_msg gmail_msg"> </s= pan><span style=3D"color:#066" class=3D"m_4561654010907287049m_-47983125606= 82989803m_-5042556665519706739m_3440269965916649927styled-by-prettify m_456= 1654010907287049m_-4798312560682989803gmail_msg gmail_msg">3</span><span st= yle=3D"color:#660" class=3D"m_4561654010907287049m_-4798312560682989803m_-5= 042556665519706739m_3440269965916649927styled-by-prettify m_456165401090728= 7049m_-4798312560682989803gmail_msg gmail_msg">)</span><span style=3D"color= :#000" class=3D"m_4561654010907287049m_-4798312560682989803m_-5042556665519= 706739m_3440269965916649927styled-by-prettify m_4561654010907287049m_-47983= 12560682989803gmail_msg gmail_msg"><br class=3D"m_4561654010907287049m_-479= 8312560682989803gmail_msg gmail_msg"><br class=3D"m_4561654010907287049m_-4= 798312560682989803gmail_msg gmail_msg"></span><span class=3D"m_456165401090= 7287049m_-4798312560682989803m_-5042556665519706739m_3440269965916649927sty= led-by-prettify m_4561654010907287049m_-4798312560682989803gmail_msg gmail_= msg"><font class=3D"m_4561654010907287049m_-4798312560682989803gmail_msg gm= ail_msg" color=3D"#000000"><div class=3D"m_4561654010907287049m_-4798312560= 682989803m_-5042556665519706739m_3440269965916649927subprettyprint m_456165= 4010907287049m_-4798312560682989803gmail_msg gmail_msg">scala> set.order= ing</div><div class=3D"m_4561654010907287049m_-4798312560682989803m_-504255= 6665519706739m_3440269965916649927subprettyprint m_4561654010907287049m_-47= 98312560682989803gmail_msg gmail_msg">res3: Ordering[Int] =3D scala.math.Or= dering$$anon$4@3ff3275b</div><div class=3D"m_4561654010907287049m_-47983125= 60682989803m_-5042556665519706739m_3440269965916649927subprettyprint m_4561= 654010907287049m_-4798312560682989803gmail_msg gmail_msg"><br class=3D"m_45= 61654010907287049m_-4798312560682989803gmail_msg gmail_msg"></div><div clas= s=3D"m_4561654010907287049m_-4798312560682989803m_-5042556665519706739m_344= 0269965916649927subprettyprint m_4561654010907287049m_-4798312560682989803g= mail_msg gmail_msg">scala> set.map(identity).ordering</div><div class=3D= "m_4561654010907287049m_-4798312560682989803m_-5042556665519706739m_3440269= 965916649927subprettyprint m_4561654010907287049m_-4798312560682989803gmail= _msg gmail_msg">res4: Ordering[Int] =3D scala.math.Ordering$Int$@7fa85a55</= div></font></span></div></code></div><div class=3D"m_4561654010907287049m_-= 4798312560682989803gmail_msg gmail_msg"><div class=3D"m_4561654010907287049= m_-4798312560682989803gmail_msg gmail_msg"><br class=3D"m_45616540109072870= 49m_-4798312560682989803gmail_msg gmail_msg"></div><div class=3D"m_45616540= 10907287049m_-4798312560682989803gmail_msg gmail_msg">I think this can be f= ixed by providing a more specific CanBuildFrom instance to be used when map= ping between two sorted collections that contain the same type.</div></div>= <div class=3D"m_4561654010907287049m_-4798312560682989803gmail_msg gmail_ms= g"><br class=3D"m_4561654010907287049m_-4798312560682989803gmail_msg gmail_= msg"></div><div class=3D"m_4561654010907287049m_-4798312560682989803gmail_m= sg gmail_msg">i.e. Provide a CanBuildFrom[Sorted[K, _], K, Sorted[K, _]] so= mewhere that has precedence over the more generic usual CanBuildFrom[CC[_],= A, CC[A]]</div><div class=3D"m_4561654010907287049m_-4798312560682989803gm= ail_msg gmail_msg"><br class=3D"m_4561654010907287049m_-4798312560682989803= gmail_msg gmail_msg"></div><div class=3D"m_4561654010907287049m_-4798312560= 682989803gmail_msg gmail_msg">I'm not sure how it could be done, but th= e static overloading resolution rules make this possible, I think.</div></d= iv></blockquote></div></div><div class=3D"gmail_extra m_4561654010907287049= m_-4798312560682989803gmail_msg gmail_msg"><div class=3D"gmail_quote m_4561= 654010907287049m_-4798312560682989803gmail_msg gmail_msg"><blockquote class= =3D"gmail_quote m_4561654010907287049m_-4798312560682989803gmail_msg gmail_= msg" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex= "><span class=3D"m_4561654010907287049m_-4798312560682989803m_-504255666551= 9706739HOEnZb m_4561654010907287049m_-4798312560682989803gmail_msg gmail_ms= g"><font class=3D"m_4561654010907287049m_-4798312560682989803gmail_msg gmai= l_msg" color=3D"#888888"> <p class=3D"m_4561654010907287049m_-4798312560682989803gmail_msg gmail_msg"= ></p> -- <br class=3D"m_4561654010907287049m_-4798312560682989803gmail_msg gmail_= msg"> You received this message because you are subscribed to the Google Groups &= quot;scala-language" group.<br class=3D"m_4561654010907287049m_-479831= 2560682989803gmail_msg gmail_msg"> To unsubscribe from this group and stop receiving emails from it, send an e= mail to <a href=3D"mailto:[email protected]" clas= s=3D"m_4561654010907287049m_-4798312560682989803gmail_msg gmail_msg" target= =3D"_blank">[email protected]</a>.</font></span><= /blockquote></div></div><div class=3D"gmail_extra m_4561654010907287049m_-4= 798312560682989803gmail_msg gmail_msg"><div class=3D"gmail_quote m_45616540= 10907287049m_-4798312560682989803gmail_msg gmail_msg"><blockquote class=3D"= gmail_quote m_4561654010907287049m_-4798312560682989803gmail_msg gmail_msg"= style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><s= pan class=3D"m_4561654010907287049m_-4798312560682989803m_-5042556665519706= 739HOEnZb m_4561654010907287049m_-4798312560682989803gmail_msg gmail_msg"><= font class=3D"m_4561654010907287049m_-4798312560682989803gmail_msg gmail_ms= g" color=3D"#888888"><br class=3D"m_4561654010907287049m_-47983125606829898= 03gmail_msg gmail_msg"> For more options, visit <a href=3D"https://groups.google.com/d/optout" clas= s=3D"m_4561654010907287049m_-4798312560682989803gmail_msg gmail_msg" target= =3D"_blank">https://groups.google.com/d/optout</a>.<br class=3D"m_456165401= 0907287049m_-4798312560682989803gmail_msg gmail_msg"> </font></span></blockquote></div></div> <p class=3D"m_4561654010907287049m_-4798312560682989803gmail_msg gmail_msg"= ></p> -- <br class=3D"m_4561654010907287049m_-4798312560682989803gmail_msg gmail_= msg"></div></div> You received this message because you are subscribed to a topic in the Goog= le Groups "scala-language" group.<br class=3D"m_45616540109072870= 49m_-4798312560682989803gmail_msg gmail_msg"> To unsubscribe from this topic, visit <a href=3D"https://groups.google.com/= d/topic/scala-language/Q5A1TTEZN4Q/unsubscribe" class=3D"m_4561654010907287= 049m_-4798312560682989803gmail_msg gmail_msg" target=3D"_blank">https://gro= ups.google.com/d/topic/scala-language/Q5A1TTEZN4Q/unsubscribe</a>.<br class= =3D"m_4561654010907287049m_-4798312560682989803gmail_msg gmail_msg"> To unsubscribe from this group and all its topics, send an email to <a href= =3D"mailto:[email protected]" class=3D"m_45616540= 10907287049m_-4798312560682989803gmail_msg gmail_msg" target=3D"_blank">sca= [email protected]</a>.<span class=3D"gmail_msg"><br = class=3D"m_4561654010907287049m_-4798312560682989803gmail_msg gmail_msg"> For more options, visit <a href=3D"https://groups.google.com/d/optout" clas= s=3D"m_4561654010907287049m_-4798312560682989803gmail_msg gmail_msg" target= =3D"_blank">https://groups.google.com/d/optout</a>.<br class=3D"m_456165401= 0907287049m_-4798312560682989803gmail_msg gmail_msg"> </span></blockquote></div><div class=3D"m_4561654010907287049HOEnZb gmail_m= sg"><div class=3D"m_4561654010907287049h5 gmail_msg"> <p class=3D"gmail_msg"></p> -- <br class=3D"gmail_msg"> You received this message because you are subscribed to the Google Groups &= quot;scala-language" group.<br class=3D"gmail_msg"> To unsubscribe from this group and stop receiving emails from it, send an e= mail to <a href=3D"mailto:[email protected]" clas= s=3D"gmail_msg" target=3D"_blank">[email protected]= om</a>.<br class=3D"gmail_msg"> For more options, visit <a href=3D"https://groups.google.com/d/optout" clas= s=3D"gmail_msg" target=3D"_blank">https://groups.google.com/d/optout</a>.<b= r class=3D"gmail_msg"> </div></div></blockquote></div><br class=3D"gmail_msg"><br clear=3D"all" cl= ass=3D"gmail_msg"><br class=3D"gmail_msg">-- <br class=3D"gmail_msg"></div>= <div class=3D"gmail_extra gmail_msg"><div class=3D"m_4561654010907287049gma= il_signature gmail_msg" data-smartmail=3D"gmail_signature"><div dir=3D"ltr"= class=3D"gmail_msg"><div class=3D"gmail_msg"><div dir=3D"ltr" class=3D"gma= il_msg"><div class=3D"gmail_msg"><div dir=3D"ltr" class=3D"gmail_msg"><div = class=3D"gmail_msg"><div dir=3D"ltr" class=3D"gmail_msg"><div class=3D"gmai= l_msg">Oliver Ruebenacker<br class=3D"gmail_msg"></div><div class=3D"gmail_= msg">Senior Software Engineer, <a href=3D"http://www.type2diabetesgenetics.= org/" class=3D"gmail_msg" target=3D"_blank">Diabetes Portal</a>, <a href=3D= "http://www.broadinstitute.org/" class=3D"gmail_msg" target=3D"_blank">Broa= d Institute</a><br class=3D"gmail_msg"></div><br class=3D"gmail_msg"></div>= </div></div></div></div></div></div></div> </div> <p class=3D"gmail_msg"></p> -- <br class=3D"gmail_msg"> You received this message because you are subscribed to a topic in the Goog= le Groups "scala-language" group.<br class=3D"gmail_msg"> To unsubscribe from this topic, visit <a href=3D"https://groups.google.com/= d/topic/scala-language/Q5A1TTEZN4Q/unsubscribe" class=3D"gmail_msg" target= =3D"_blank">https://groups.google.com/d/topic/scala-language/Q5A1TTEZN4Q/un= subscribe</a>.<br class=3D"gmail_msg"> To unsubscribe from this group and all its topics, send an email to <a href= =3D"mailto:[email protected]" class=3D"gmail_msg"= target=3D"_blank">[email protected]</a>.<br clas= s=3D"gmail_msg"> For more options, visit <a href=3D"https://groups.google.com/d/optout" clas= s=3D"gmail_msg" target=3D"_blank">https://groups.google.com/d/optout</a>.<b= r class=3D"gmail_msg"> </blockquote></div> <p></p> -- <br /> You received this message because you are subscribed to the Google Groups &= quot;scala-language" group.<br /> To unsubscribe from this group and stop receiving emails from it, send an e= mail to <a href=3D"mailto:[email protected]">scal= [email protected]</a>.<br /> For more options, visit <a href=3D"https://groups.google.com/d/optout">http= s://groups.google.com/d/optout</a>.<br /> --001a114a7ede8776df0542765ba8--