Is a set a sequence?

I did the research work for you, since I know exactly what I was looking for.

You may not know it, but this thread is far from being the first discussion on the Swift Evolution mailing list/forums about sequences. There used to be many more. On many many aspects.

This quote from @xwu in this former version of the elementsEqual renaming proposal sums them up quite well:

A third solution is to dramatically overhaul the protocol hierarchy for Swift sequences and collections so that unordered collections no longer have members such as first and elementsEqual(_:). However, this would be a colossal and source-breaking undertaking, and it is unlikely to be satisfactory in addressing all the axes of differences among sequence and collection types:

  • Finite versus infinite
  • Single-pass versus multi-pass
  • Ordered versus unordered
  • Lazy versus eager
  • Forward/bidirectional/random-access

I know you're very focused on a specific problem. But please let this paragraph sink into you. Do make this effort. You may then understand this comment.

2 Likes