<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><div>Why not use an equals Implementation that doesn't rely on order?</div><div><br></div><div>Something like this (which doesn't compile in my iPad playground). If two sets have the same number of elements, and every element in one can be found in the other, they are equal, otherwise they are not equal.</div><div><br></div><div><div>protocol Set &nbsp;{</div><div>&nbsp; &nbsp; static func == (lhs: Self, rhs: Self) {</div><div>&nbsp; &nbsp; guard lhs.count == rhs.count else { return false }</div><div>&nbsp; &nbsp; for x in lhs {</div><div>&nbsp; &nbsp; if !rhs.contains(x) { return false }</div><div>&nbsp; &nbsp; }</div><div>&nbsp; &nbsp; &nbsp; &nbsp; return true</div><div>&nbsp; &nbsp; }</div><div>}</div><br><div><span style="background-color: rgba(255, 255, 255, 0);">--<br>C. Keith Ray</span><div><span style="background-color: rgba(255, 255, 255, 0);"><br></span></div><div><span style="background-color: rgba(255, 255, 255, 0);">*&nbsp;<a href="https://leanpub.com/wepntk">https://leanpub.com/wepntk</a>&nbsp;&lt;- buy my book?<br>*&nbsp;</span><a href="http://www.thirdfoundationsw.com/keith_ray_resume_2014_long.pdf">http://www.thirdfoundationsw.com/keith_ray_resume_2014_long.pdf</a><span style="background-color: rgba(255, 255, 255, 0);"><br>*&nbsp;<a href="http://agilesolutionspace.blogspot.com/">http://agilesolutionspace.blogspot.com/</a></span></div></div></div><div><br>On Oct 15, 2017, at 12:40 PM, Kevin Nattinger via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a>&gt; wrote:<br><br></div><blockquote type="cite"><div><meta http-equiv="Content-Type" content="text/html charset=utf-8"><div><blockquote type="cite" class=""><div class=""><div dir="auto" style="text-align: start; text-indent: 0px;" class=""><font color="#000000" class="">[…]</font></div><div dir="auto" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">Swift's Sequence protocol does not require the order of iteration to "convey any meaning"; it doesn't even require it to be deterministic.</div><div dir="auto" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><br class=""></div><blockquote class="gmail_quote" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-style: solid; border-left-color: rgb(204, 204, 204); padding-left: 1ex;"><div style="word-wrap: break-word;" class=""><div class=""></div></div></blockquote></div></blockquote><br class="">And that’s EXACTLY why none of the functions on Sequence should rely on the order conveying meaning. &nbsp;`ElementsEqual` (for example) DOES rely on the order of iteration conveying a meaning not required by the protocol, and renaming it `lexicographicallyEquals` does not change that fact. Either Sequence needs to require a meaningful order or `elementsEqual` should be moved to a protocol that does.</div><div><br class=""></div></div></blockquote><blockquote type="cite"><div><span>_______________________________________________</span><br><span>swift-evolution mailing list</span><br><span><a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a></span><br><span><a href="https://lists.swift.org/mailman/listinfo/swift-evolution">https://lists.swift.org/mailman/listinfo/swift-evolution</a></span><br></div></blockquote></body></html>