[Draft] Rename Sequence.elementsEqual

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)&gt;, 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> <Microsoft Learn: Build skills that open doors in your career, but the more basic ICollection<T> <Microsoft Learn: Build skills that open doors in your career. 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

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.

···

On Oct 17, 2017, at 12:48 PM, Jonathan Hull via swift-evolution <swift-evolution@swift.org> wrote:

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)&gt;, 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> <Microsoft Learn: Build skills that open doors in your career, but the more basic ICollection<T> <Microsoft Learn: Build skills that open doors in your career. 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
_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution