<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">But HashSet<T> does implement IEnumerable<T>, and therefore you can still call SequenceEqual on it. .Net does not distinguish between ordered and unordered enumerables. Random access is a different concept than enumerability.<br class=""><div><br class=""><blockquote type="cite" class=""><div class="">On Oct 17, 2017, at 12:48 PM, Jonathan Hull via swift-evolution <<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html charset=utf-8" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Also of interest to this discussion is the following from a discussion on C#’s version of Set:<div class=""><br class=""></div><div class=""><blockquote type="cite" class=""><p style="margin: 0px 0px 1em; padding: 0px; border: 0px; font-variant-ligatures: normal; font-variant-numeric: inherit; font-stretch: inherit; font-size: 15px; line-height: inherit; font-family: Arial, 'Helvetica Neue', Helvetica, sans-serif; vertical-align: baseline; clear: both; color: rgb(36, 39, 41); orphans: 2; widows: 2; background-color: rgb(255, 255, 255);" class=""><code style="margin: 0px; padding: 1px 5px; border: 0px; font-style: inherit; font-variant-ligatures: inherit; font-variant-position: inherit; font-variant-caps: inherit; font-variant-numeric: inherit; font-variant-alternates: inherit; font-variant-east-asian: inherit; font-stretch: inherit; font-size: 13px; line-height: inherit; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, sans-serif; vertical-align: baseline; background-color: rgb(239, 240, 241); white-space: pre-wrap;" class="">HashSet<T></code> is more or less modeled after a <a href="http://en.wikipedia.org/wiki/Set_(mathematics)" rel="noreferrer" title="Wikipedia article" style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant-ligatures: inherit; font-variant-position: inherit; font-variant-caps: inherit; font-variant-numeric: inherit; font-variant-alternates: inherit; font-variant-east-asian: inherit; font-stretch: inherit; font-size: inherit; line-height: inherit; font-family: inherit; vertical-align: baseline; color: rgb(0, 89, 153); text-decoration: none; cursor: pointer;" class="">mathematical set</a>, which means that:</p><ol style="margin: 0px 0px 1em 30px; padding: 0px; border: 0px; font-variant-ligatures: normal; font-variant-numeric: inherit; font-stretch: inherit; font-size: 15px; line-height: inherit; font-family: Arial, 'Helvetica Neue', Helvetica, sans-serif; vertical-align: baseline; list-style-position: initial; list-style-image: initial; color: rgb(36, 39, 41); orphans: 2; widows: 2; background-color: rgb(255, 255, 255);" class=""><li style="margin: 0px 0px 0.5em; padding: 0px; border: 0px; font-style: inherit; font-variant-ligatures: inherit; font-variant-position: inherit; font-variant-caps: inherit; font-variant-numeric: inherit; font-variant-alternates: inherit; font-variant-east-asian: inherit; font-stretch: inherit; font-size: inherit; line-height: inherit; font-family: inherit; vertical-align: baseline; word-wrap: break-word;" class=""><div style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant-ligatures: inherit; font-variant-position: inherit; font-variant-caps: inherit; font-variant-numeric: inherit; font-variant-alternates: inherit; font-variant-east-asian: inherit; font-stretch: inherit; font-size: inherit; line-height: inherit; font-family: inherit; vertical-align: baseline; clear: both;" class="">It may contain no duplicate values.</div></li><li style="margin: 0px 0px 0.5em; padding: 0px; border: 0px; font-style: inherit; font-variant-ligatures: inherit; font-variant-position: inherit; font-variant-caps: inherit; font-variant-numeric: inherit; font-variant-alternates: inherit; font-variant-east-asian: inherit; font-stretch: inherit; font-size: inherit; line-height: inherit; font-family: inherit; vertical-align: baseline; word-wrap: break-word;" class=""><div style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant-ligatures: inherit; font-variant-position: inherit; font-variant-caps: inherit; font-variant-numeric: inherit; font-variant-alternates: inherit; font-variant-east-asian: inherit; font-stretch: inherit; font-size: inherit; line-height: inherit; font-family: inherit; vertical-align: baseline; clear: both;" class="">Its elements are in no particular order; therefore the type does not implement the <a href="http://msdn.microsoft.com/en-us/library/5y536ey6.aspx" rel="noreferrer" title="MSDN reference page" style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant-ligatures: inherit; font-variant-position: inherit; font-variant-caps: inherit; font-variant-numeric: inherit; font-variant-alternates: inherit; font-variant-east-asian: inherit; font-stretch: inherit; font-size: inherit; line-height: inherit; font-family: inherit; vertical-align: baseline; color: rgb(0, 89, 153); text-decoration: none; cursor: pointer;" class=""><code style="margin: 0px; padding: 1px 5px; border: 0px; font-style: inherit; font-variant-ligatures: inherit; font-variant-position: inherit; font-variant-caps: inherit; font-variant-numeric: inherit; font-variant-alternates: inherit; font-variant-east-asian: inherit; font-stretch: inherit; font-size: 13px; line-height: inherit; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, sans-serif; vertical-align: baseline; background-color: rgb(239, 240, 241); white-space: pre-wrap;" class="">IList<T></code></a>interface, but the more basic <a href="http://msdn.microsoft.com/en-us/library/92t2ye13.aspx" rel="noreferrer" title="MSDN reference page" style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant-ligatures: inherit; font-variant-position: inherit; font-variant-caps: inherit; font-variant-numeric: inherit; font-variant-alternates: inherit; font-variant-east-asian: inherit; font-stretch: inherit; font-size: inherit; line-height: inherit; font-family: inherit; vertical-align: baseline; color: rgb(0, 89, 153); text-decoration: none; cursor: pointer;" class=""><code style="margin: 0px; padding: 1px 5px; border: 0px; font-style: inherit; font-variant-ligatures: inherit; font-variant-position: inherit; font-variant-caps: inherit; font-variant-numeric: inherit; font-variant-alternates: inherit; font-variant-east-asian: inherit; font-stretch: inherit; font-size: 13px; line-height: inherit; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, sans-serif; vertical-align: baseline; background-color: rgb(239, 240, 241); white-space: pre-wrap;" class="">ICollection<T></code></a>. As a consequence, elements inside a hash set cannot be randomly accessed through indices; they can only be iterated over through an enumerator.</div></li></ol></blockquote><div class="">So, it appears that C#/.Net does in fact take into account the fact that Sets are unordered, and only allows it to be iterated (as opposed to accessed with indices).</div></div><div class=""><br class=""></div><div class="">Thanks,</div><div class="">Jon</div></div>_______________________________________________<br class="">swift-evolution mailing list<br class=""><a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a><br class="">https://lists.swift.org/mailman/listinfo/swift-evolution<br class=""></div></blockquote></div><br class=""></body></html>