<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Sat, Oct 14, 2017 at 3:45 AM, Brent Royal-Gordon via swift-evolution <span dir="ltr"><<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">> On Oct 12, 2017, at 9:57 PM, Kevin Nattinger via swift-evolution <<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a>> wrote:<br>
><br>
</span><span class="">> That is reflected in the fact that over half the methods in the main Sequence definition* make no sense and are not well-defined unless there is a well-defined order to the sequence itself. What does it even mean to `dropFirst()` in a Set?<br>
<br>
</span>It means to skip the first element the set would normally have given you. Which element this will be may be arbitrary, but this is still not useless:<br>
<br>
set.dropFirst().reduce(set.<wbr>first!, …)<br></blockquote><div><br></div><div>Do we have the guarantee that set.dropFirst() is going to return the same element as set.first! ?</div><div><br></div><div>I don't understand how you can build generic algorithms over Sequence using first() and last() that work if the protocol itself doesn't give any guarantee about ordering.. Unless "first" and "last" both mean "any"...</div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
Even elementsEqual(_:) does tell you something potentially valuable: Whether two instances will end up giving the same result when processed by an ordering-sensitive algorithm.<br>
<br>
We should change the name to something like orderEquals(_:), and maybe change the lexicographicallyPrecedes(_:) method to something analogous like orderPrecedes(_:), and then be done with it.<br>
<span class="HOEnZb"><font color="#888888"><br>
--<br>
Brent Royal-Gordon<br>
Sent from my iPhone<br>
</font></span><div class="HOEnZb"><div class="h5"><br>
______________________________<wbr>_________________<br>
swift-evolution mailing list<br>
<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a><br>
<a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" target="_blank">https://lists.swift.org/<wbr>mailman/listinfo/swift-<wbr>evolution</a><br>
</div></div></blockquote></div><br></div></div>