[swift-evolution] [Draft] Rename Sequence.elementsEqual
Jonathan Hull
jhull at gbis.com
Tue Oct 17 14:48:15 CDT 2017
Also of interest to this discussion is the following from a discussion on C#’s version of Set:
> HashSet<T> is more or less modeled after a mathematical set <http://en.wikipedia.org/wiki/Set_(mathematics)>, which means that:
>
> It may contain no duplicate values.
> Its elements are in no particular order; therefore the type does not implement the IList<T> <http://msdn.microsoft.com/en-us/library/5y536ey6.aspx>interface, but the more basic ICollection<T> <http://msdn.microsoft.com/en-us/library/92t2ye13.aspx>. As a consequence, elements inside a hash set cannot be randomly accessed through indices; they can only be iterated over through an enumerator.
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).
Thanks,
Jon
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20171017/0e10fed1/attachment.html>
More information about the swift-evolution
mailing list