<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Well said, Kevin! I agree to all points you made. Yes, a Set has no intrinsic order, just an iteration over a set has. And the latter does not even have to be stable.<div class=""><br class=""></div><div class="">Let’s split Iterable off Sequence.</div><div class=""><br class=""></div><div class="">-Thorsten<br class=""><div class=""><br class=""></div><div class=""><br class=""><div><blockquote type="cite" class=""><div class="">Am 14.10.2017 um 09:28 schrieb Kevin Nattinger via swift-evolution <<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>>:</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=""><br class=""><div class=""><blockquote type="cite" class=""><div class="">On Oct 13, 2017, at 8:28 PM, Xiaodi Wu <<a href="mailto:xiaodi.wu@gmail.com" class="">xiaodi.wu@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><br class="Apple-interchange-newline"><br 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=""><div 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;">On Fri, Oct 13, 2017 at 12:03 PM, Kevin Nattinger<span class="Apple-converted-space"> </span><span dir="ltr" class=""><<a href="mailto:swift@nattinger.net" target="_blank" class="">swift@nattinger.net</a>></span><span class="Apple-converted-space"> </span>wrote:<br class=""><blockquote class="gmail_quote" style="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 dir="auto" style="word-wrap: break-word;" class=""><div dir="auto" style="word-wrap: break-word;" class=""><div class=""><span class=""><blockquote type="cite" class=""><div class="">On Oct 13, 2017, at 6:52 AM, Xiaodi Wu <<a href="mailto:xiaodi.wu@gmail.com" target="_blank" class="">xiaodi.wu@gmail.com</a>> wrote:</div><br class="m_4644553253174523011Apple-interchange-newline"><div class=""><div class=""><div dir="auto" class="">You’re welcome to bikeshed the entire API surface area of sequences and collections, but you won’t be the first to explore this area. A number of us looked into this area in the past few years and did not reach a measurable improved result.</div></div></div></blockquote><div class=""><br class=""></div></span><div class="">I don’t need or want to bikeshed the entire sequence and collection surface area, I just want to fix one clear and GLARING issue:</div><div class=""><br class=""></div><div class=""><font size="4" class="">A Set is NOT a sequence.</font></div><div class=""><br class=""></div><div class="">Note that this goes for dictionaries and any other unordered “sequences" as well.</div><div class=""><br class=""></div><div class="">That was in an early draft of my original email, but I dropped it because I was afraid people would just stop reading and dismiss the idea out-of-hand without considering the problem or arguments. Apparently I should have at least put it at the bottom, so sorry if the root issue was unclear.</div><span class=""><br class=""><blockquote type="cite" class=""><div class=""><div class=""><div dir="auto" class="">Sequences can be ordered or unordered,</div></div></div></blockquote><div class=""><br class=""></div></span><div class="">You seem to be confusing the English word “sequence” with the (current) Swift protocol “Sequence." A sequence is, by definition, ordered. Not enforcing that in a protocol does not override the English language, and as this entire thread demonstrates, causes issues further on down the line.</div></div></div></div></div></blockquote><div class=""><br class=""></div><div class="">We are discussing the Swift protocol `Sequence`. It really doesn't matter at all what the English word "sequence" means, and any difference between the English word and the Swift term is emphatically *not* the root cause of the issue. Here's why:</div><div class=""><br class=""></div><div class="">* A Swift `Sequence` is, to put it simplistically, a thing that can be iterated over in a `for...in` loop. If it would make you happy, for the rest of the discussion, let's suppose we called the protocol `ForLoopable` instead of `Sequence`.</div></div></div></blockquote><div class=""><br class=""></div><div class="">ForLoopable is so ugly. Since we’re just iterating over the elements, how about, oh, say, `Iterable`? Hey, that looks familiar.</div><br class=""><blockquote type="cite" class=""><div class=""><div 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;"><div class=""><br class=""></div><div class="">* `Set` should conform to `ForLoopable`. (This I state as a premise; if you disagree with the notion that we should be able to iterate over the elements of an instance of `Set` with a `for...in loop`, then it's clearly a whole other discussion and not a question of what the English word "sequence" means.)</div></div></div></blockquote><div class=""><br class=""></div>Obviously, `Set: Iterable`. I don’t think I’ve said anything to suggest you shouldn’t be able to iterate over unordered collections.</div><div class=""><br class=""><blockquote type="cite" class=""><div class=""><div 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;"><div class=""><br class=""></div><div class="">* If a type `T` conforms to `ForLoopable` and an instance `t` of that type has at least one element, then *something* has to be the first element in a `for element in t { ... }` loop. Put another way, every instance of a type that conforms to `ForLoopable` must have at least one publicly observable order (although, intriguingly, I'm not sure it has to be a repeatable one). It is possible, therefore, to have a semantic answer to the question of which element is `first` or (if finite) `last`; one can also `drop(while:)`, etc., and perform lexicographical comparisons.</div></div></div></blockquote><div class=""><br class=""></div>As a side effect of Swift being a procedural language each iteration happens to occur in some order, yes, but that order is meaningless and reflects nothing about the Set itself. In fact, I’d say that <b class="">`first`, `last`, etc. are not even defined on the original Set per se, only on the specific order that a particular iteration resulted in</b>. And that order is not necessarily predictable, nor necessarily stable, as you yourself said.</div><div class=""><br class=""></div><div class="">Consider an Iterable that gives a different order every time it’s iterated. </div><div class="">Should calling `.first` or `last` give a different object every time? That’s absurd.</div><div class="">Should an object lexicographically compare not equal to itself? Even more absurd. </div><div class=""><br class=""></div><div class="">On the other hand, if I have a collection of objects that I want iterated in a particular order, I can use a container that iterates in a specific, known, well-defined way, and use that to construct the sequence of objects. That’s clearly an Iterable collection, but the guarantee is stronger than that. Since it iterates objects in a specific sequence, the logical way to express that would be `Sequence: Iterable`. Again, we’ve seen that before. </div><div class=""><br class=""></div><div class="">Now, since a Sequence is guaranteed to iterate the same every time, suddenly our `first`, `last`, `drop*`, etc. methods have a meaning inherent to the collection itself, rather than a specific iteration. </div><div class="">`first` is the first object in the Sequence. It doesn’t matter how the sequence came to be in that order; it doesn’t matter whether or not the sequence has already been iterated or how many times. `first` is the first object that is, was, and always will be presented by the Sequence’s Iterator. (Until the collection is mutated, obviously).</div><div class=""><br class=""></div><div style="font-size: 13px;" class=""><b class="">To summarize,</b></div><div class="">A Set has no intrinsic order. You can iterate over it, and a specific iteration of a set has an order, but that order is not tied to the Set itself beyond including all and only the items therein. Therefore, the Set itself has no intrinsic `first`, `last`, lexicographical comparison, etc.; only its iterations do, and they are not themselves Sets.</div><div class="">A Sequence does have an intrinsic order. The order of iteration reflects the order inherent to the Sequence. Therefore, a Sequence has a `first`, `last`, lexicographical comparison, etc.</div><div class=""><br class=""></div><div class="">Just in case it’s not obvious, `Set` here is pretty much interchangeable with any other unordered iterable.</div><div class=""><br class=""></div><div class=""><blockquote type="cite" class=""><div class=""><div 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;"><blockquote class="gmail_quote" style="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 dir="auto" style="word-wrap: break-word;" class=""><div dir="auto" style="word-wrap: break-word;" class=""><div class=""><div class=""><div class="h5"><blockquote type="cite" class=""><div class=""><div class=""><div class=""><div class="gmail_quote"><blockquote class="gmail_quote" style="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 class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="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 class=""><div style="margin: 0px; line-height: normal; font-family: 'Andale Mono'; color: rgb(233, 175, 205); background-color: rgba(0, 0, 0, 0.901961);" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">public</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(214, 214, 214);" class=""><span class="Apple-converted-space"> </span></span><span style="font-variant-ligatures: no-common-ligatures;" class="">protocol</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(214, 214, 214);" class=""><span class="Apple-converted-space"> </span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(52, 187, 200);" class="">Iterable</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(214, 214, 214);" class=""><span class="Apple-converted-space"> </span>{</span></div><div style="margin: 0px; line-height: normal; font-family: 'Andale Mono'; color: rgb(52, 188, 38); background-color: rgba(0, 0, 0, 0.901961);" class=""><span style="font-variant-ligatures: no-common-ligatures; color: rgb(214, 214, 214);" class=""> <span class="Apple-converted-space"> </span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(205, 121, 35);" class="">associatedtype</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(214, 214, 214);" class=""><span class="Apple-converted-space"> </span>Iterator</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(233, 175, 205);" class="">:</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(214, 214, 214);" class=""><span class="Apple-converted-space"> </span></span><span style="font-variant-ligatures: no-common-ligatures;" class="">IteratorProtocol</span></div><div style="margin: 0px; line-height: normal; font-family: 'Andale Mono'; color: rgb(130, 185, 255); background-color: rgba(0, 0, 0, 0.901961);" class=""><span style="font-variant-ligatures: no-common-ligatures; color: rgb(214, 214, 214);" class=""> <span class="Apple-converted-space"> </span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(233, 175, 205);" class="">func</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(214, 214, 214);" class=""><span class="Apple-converted-space"> </span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(52, 187, 200);" class="">map</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(233, 175, 205);" class=""><</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(52, 187, 200);" class="">T</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(233, 175, 205);" class="">></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(214, 214, 214);" class="">(</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(52, 187, 200);" class="">...</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(214, 214, 214);" class="">)<span class="Apple-converted-space"> </span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(233, 175, 205);" class="">-></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(214, 214, 214);" class=""><span class="Apple-converted-space"> </span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(233, 175, 205);" class="">[</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(52, 188, 38);" class="">T</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(233, 175, 205);" class="">]</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(214, 214, 214);" class=""><span class="Apple-converted-space"> </span></span><span style="font-variant-ligatures: no-common-ligatures;" class="">// Iterable where .Iterator.Element == T</span></div><div style="margin: 0px; line-height: normal; font-family: 'Andale Mono'; color: rgb(130, 185, 255); background-color: rgba(0, 0, 0, 0.901961);" class=""><span style="font-variant-ligatures: no-common-ligatures; color: rgb(214, 214, 214);" class=""> <span class="Apple-converted-space"> </span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(233, 175, 205);" class="">func</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(214, 214, 214);" class=""><span class="Apple-converted-space"> </span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(52, 187, 200);" class="">filter</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(214, 214, 214);" class="">(</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(52, 187, 200);" class="">...</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(214, 214, 214);" class="">)<span class="Apple-converted-space"> </span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(233, 175, 205);" class="">-></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(214, 214, 214);" class=""><span class="Apple-converted-space"> </span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(233, 175, 205);" class="">[</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(52, 188, 38);" class="">Iterator.Element</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(233, 175, 205);" class="">]</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(214, 214, 214);" class=""><span class="Apple-converted-space"> </span></span><span style="font-variant-ligatures: no-common-ligatures;" class="">// Iterable where .Iterator.Element == Self.Iterator.Element</span></div><div style="margin: 0px; line-height: normal; font-family: 'Andale Mono'; color: rgb(52, 187, 200); background-color: rgba(0, 0, 0, 0.901961);" class=""><span style="font-variant-ligatures: no-common-ligatures; color: rgb(214, 214, 214);" class=""> <span class="Apple-converted-space"> </span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(233, 175, 205);" class="">func</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(214, 214, 214);" class=""><span class="Apple-converted-space"> </span></span><span style="font-variant-ligatures: no-common-ligatures;" class="">forEach</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(214, 214, 214);" class="">(</span><span style="font-variant-ligatures: no-common-ligatures;" class="">...</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(214, 214, 214);" class="">)</span></div><div style="margin: 0px; line-height: normal; font-family: 'Andale Mono'; color: rgb(52, 187, 200); background-color: rgba(0, 0, 0, 0.901961);" class=""><span style="font-variant-ligatures: no-common-ligatures; color: rgb(214, 214, 214);" class=""> <span class="Apple-converted-space"> </span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(233, 175, 205);" class="">func</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(214, 214, 214);" class=""><span class="Apple-converted-space"> </span></span><span style="font-variant-ligatures: no-common-ligatures;" class="">makeIterator</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(214, 214, 214);" class="">()<span class="Apple-converted-space"> </span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(233, 175, 205);" class="">-></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(214, 214, 214);" class=""><span class="Apple-converted-space"> </span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(52, 188, 38);" class="">Iterator</span></div><div style="margin: 0px; line-height: normal; font-family: 'Andale Mono'; color: rgb(52, 187, 200); background-color: rgba(0, 0, 0, 0.901961);" class=""><span style="font-variant-ligatures: no-common-ligatures; color: rgb(214, 214, 214);" class=""> <span class="Apple-converted-space"> </span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(233, 175, 205);" class="">var</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(214, 214, 214);" class=""><span class="Apple-converted-space"> </span></span><span style="font-variant-ligatures: no-common-ligatures;" class="">underestimatedCount</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(233, 175, 205);" class="">:</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(214, 214, 214);" class=""><span class="Apple-converted-space"> </span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(52, 188, 38);" class="">Int</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(214, 214, 214);" class=""><span class="Apple-converted-space"> </span>{<span class="Apple-converted-space"> </span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(205, 121, 35);" class="">get</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(214, 214, 214);" class=""><span class="Apple-converted-space"> </span>}</span></div><div style="margin: 0px; line-height: normal; font-family: 'Andale Mono'; color: rgb(214, 214, 214); background-color: rgba(0, 0, 0, 0.901961);" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">}</span></div><div style="margin: 0px; line-height: normal; font-family: 'Andale Mono'; color: rgb(214, 214, 214); background-color: rgba(0, 0, 0, 0.901961); min-height: 14px;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""></span><br class=""></div><div style="margin: 0px; line-height: normal; font-family: 'Andale Mono'; color: rgb(130, 185, 255); background-color: rgba(0, 0, 0, 0.901961);" class=""><span style="font-variant-ligatures: no-common-ligatures; color: rgb(233, 175, 205);" class="">public</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(214, 214, 214);" class=""><span class="Apple-converted-space"> </span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(233, 175, 205);" class="">protocol</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(214, 214, 214);" class=""><span class="Apple-converted-space"> </span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(52, 187, 200);" class="">Sequence</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(233, 175, 205);" class="">:</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(214, 214, 214);" class=""><span class="Apple-converted-space"> </span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(52, 188, 38);" class="">Iterable</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(214, 214, 214);" class=""><span class="Apple-converted-space"> </span>{<span class="Apple-converted-space"> </span></span><span style="font-variant-ligatures: no-common-ligatures;" class="">// Maybe OrderedSequence just to make the well-defined-order requirement explicit</span></div><div style="margin: 0px; line-height: normal; font-family: 'Andale Mono'; color: rgb(214, 214, 214); background-color: rgba(0, 0, 0, 0.901961);" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""> <span class="Apple-converted-space"> </span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(205, 121, 35);" class="">associatedtype</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space"> </span>SubSequence</span></div><div style="margin: 0px; line-height: normal; font-family: 'Andale Mono'; color: rgb(130, 185, 255); background-color: rgba(0, 0, 0, 0.901961);" class=""><span style="font-variant-ligatures: no-common-ligatures; color: rgb(214, 214, 214);" class=""> <span class="Apple-converted-space"> </span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(233, 175, 205);" class="">func</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(214, 214, 214);" class=""><span class="Apple-converted-space"> </span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(52, 187, 200);" class="">dropFirst</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(214, 214, 214);" class="">(</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(52, 187, 200);" class="">...</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(214, 214, 214);" class="">) <span class="Apple-converted-space"> </span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(233, 175, 205);" class="">-></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(214, 214, 214);" class=""><span class="Apple-converted-space"> </span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(52, 188, 38);" class="">SubSequence</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(214, 214, 214);" class=""><span class="Apple-converted-space"> </span> <span class="Apple-converted-space"> </span></span><span style="font-variant-ligatures: no-common-ligatures;" class="">// Sequence where .Iterator.Element == Self.Iterator.Element</span></div><div style="margin: 0px; line-height: normal; font-family: 'Andale Mono'; color: rgb(214, 214, 214); background-color: rgba(0, 0, 0, 0.901961);" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""> <span class="Apple-converted-space"> </span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(233, 175, 205);" class="">func</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space"> </span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(52, 187, 200);" class="">dropLast</span><span style="font-variant-ligatures: no-common-ligatures;" class="">(</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(52, 187, 200);" class="">...</span><span style="font-variant-ligatures: no-common-ligatures;" class="">) <span class="Apple-converted-space"> </span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(233, 175, 205);" class="">-></span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space"> </span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(52, 188, 38);" class="">SubSequence</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space"> </span> <span class="Apple-converted-space"> </span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(130, 185, 255);" class="">// " "</span></div><div style="margin: 0px; line-height: normal; font-family: 'Andale Mono'; color: rgb(214, 214, 214); background-color: rgba(0, 0, 0, 0.901961);" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""> <span class="Apple-converted-space"> </span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(233, 175, 205);" class="">func</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space"> </span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(52, 187, 200);" class="">drop</span><span style="font-variant-ligatures: no-common-ligatures;" class="">(</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(205, 121, 35);" class="">while</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(52, 187, 200);" class="">...</span><span style="font-variant-ligatures: no-common-ligatures;" class="">) <span class="Apple-converted-space"> </span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(233, 175, 205);" class="">-></span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space"> </span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(52, 188, 38);" class="">SubSequence</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space"> </span> <span class="Apple-converted-space"> </span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(130, 185, 255);" class="">// " "</span></div><div style="margin: 0px; line-height: normal; font-family: 'Andale Mono'; color: rgb(214, 214, 214); background-color: rgba(0, 0, 0, 0.901961);" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""> <span class="Apple-converted-space"> </span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(233, 175, 205);" class="">func</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space"> </span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(52, 187, 200);" class="">prefix</span><span style="font-variant-ligatures: no-common-ligatures;" class="">(</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(52, 187, 200);" class="">...</span><span style="font-variant-ligatures: no-common-ligatures;" class="">) <span class="Apple-converted-space"> </span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(233, 175, 205);" class="">-></span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space"> </span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(52, 188, 38);" class="">SubSequence</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space"> </span> <span class="Apple-converted-space"> </span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(130, 185, 255);" class="">// " "</span></div><div style="margin: 0px; line-height: normal; font-family: 'Andale Mono'; color: rgb(52, 188, 38); background-color: rgba(0, 0, 0, 0.901961);" class=""><span style="font-variant-ligatures: no-common-ligatures; color: rgb(214, 214, 214);" class=""> <span class="Apple-converted-space"> </span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(233, 175, 205);" class="">func</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(214, 214, 214);" class=""><span class="Apple-converted-space"> </span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(52, 187, 200);" class="">prefix</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(214, 214, 214);" class="">(</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(205, 121, 35);" class="">while</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(52, 187, 200);" class="">...</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(214, 214, 214);" class="">)<span class="Apple-converted-space"> </span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(233, 175, 205);" class="">-></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(214, 214, 214);" class=""><span class="Apple-converted-space"> </span></span><span style="font-variant-ligatures: no-common-ligatures;" class="">SubSequence</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(214, 214, 214);" class=""><span class="Apple-converted-space"> </span> <span class="Apple-converted-space"> </span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(130, 185, 255);" class="">// " "</span></div><div style="margin: 0px; line-height: normal; font-family: 'Andale Mono'; color: rgb(214, 214, 214); background-color: rgba(0, 0, 0, 0.901961);" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""> <span class="Apple-converted-space"> </span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(233, 175, 205);" class="">func</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space"> </span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(52, 187, 200);" class="">suffix</span><span style="font-variant-ligatures: no-common-ligatures;" class="">(</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(52, 187, 200);" class="">...</span><span style="font-variant-ligatures: no-common-ligatures;" class="">) <span class="Apple-converted-space"> </span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(233, 175, 205);" class="">-></span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space"> </span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(52, 188, 38);" class="">SubSequence</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space"> </span> <span class="Apple-converted-space"> </span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(130, 185, 255);" class="">// " "</span></div><div style="margin: 0px; line-height: normal; font-family: 'Andale Mono'; color: rgb(130, 185, 255); background-color: rgba(0, 0, 0, 0.901961);" class=""><span style="font-variant-ligatures: no-common-ligatures; color: rgb(214, 214, 214);" class=""> <span class="Apple-converted-space"> </span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(233, 175, 205);" class="">func</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(214, 214, 214);" class=""><span class="Apple-converted-space"> </span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(52, 187, 200);" class="">split</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(214, 214, 214);" class="">(</span><span style="color: rgb(52, 187, 200);" class="">...</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(205, 121, 35);" class="">where</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(52, 187, 200);" class="">...</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(214, 214, 214);" class="">) <span class="Apple-converted-space"> </span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(233, 175, 205);" class="">-></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(214, 214, 214);" class=""><span class="Apple-converted-space"> </span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(233, 175, 205);" class="">[</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(52, 188, 38);" class="">SubSequence</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(233, 175, 205);" class="">]</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(214, 214, 214);" class=""><span class="Apple-converted-space"> </span></span><span style="font-variant-ligatures: no-common-ligatures;" class="">// Iterable where .Iterator.Element == (Sequence where .Iterator.Element == Self.Iterator.Element)</span></div><div style="margin: 0px; line-height: normal; font-family: 'Andale Mono'; color: rgb(214, 214, 214); background-color: rgba(0, 0, 0, 0.901961);" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">}</span></div></div></div></div></blockquote></div></div></blockquote></div></div></div></div></blockquote></div></div></div></div></div></div></blockquote></div></div></blockquote></div><div class=""><br class=""></div>And just to be explicit, <div class="">struct Set: Iterable {…}</div><div class="">struct Dictionary: Iterable {…}</div><div class="">struct Array: Sequence {…}</div><div class="">etc.</div><div class=""><br class=""></div><div class="">Hopefully at some point:</div><div class="">struct OrderedSet: Sequence {…}<br class=""><div class=""><br class=""></div></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=""></div></div></body></html>