<div dir="ltr">On Sat, Oct 14, 2017 at 6:17 PM, Kevin Nattinger <span dir="ltr"><<a href="mailto:swift@nattinger.net" target="_blank">swift@nattinger.net</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div style="overflow-wrap: break-word;"><div dir="auto" style="overflow-wrap: break-word;"><div><blockquote type="cite"><div><div dir="ltr" style="text-align:start;text-indent:0px"><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div style="overflow-wrap: break-word;"><div><span class="gmail-m_-6771000053672623098gmail-"><blockquote type="cite"><div><div class="gmail_quote" style="text-align:start;text-indent:0px"><div><font color="#000000">[…]</font></div><span class="gmail-"><div style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-transform:none;white-space:normal;word-spacing:0px">* 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></span></div></div></blockquote><div style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-transform:none;white-space:normal;word-spacing:0px"><br></div></span><span class="gmail-"><div style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-transform:none;white-space:normal;word-spacing:0px">ForLoopable is so ugly. Since we’re just iterating over the elements, how about, oh, say, `Iterable`? Hey, that looks familiar.</div></span></div></div></blockquote><span class="gmail-"><div style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-transform:none;white-space:normal;word-spacing:0px"><br></div><div style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-transform:none;white-space:normal;word-spacing:0px">I'm not trying to bikeshed the name of `Sequence`. I'm picking an intentionally unwieldy name for the purposes of discussing the semantics of this particular protocol. The point is that the underlying issue has nothing to do with the name; it can be `Iterable` or it can be `SpongeBob` for all I care.</div></span></div></div></div></div></blockquote><div><br></div><div>I’m not trying to bikeshed the name either, The underlying issue is that (what is currently) Sequence actually encompasses two separate functionalities, and those functionalities need to be separated with their separate semantic requirements documented. “Sequence: Iterable,” “OrderedSequence: Sequence,” “SpongeBob: ForLoopable,” the names are 100% irrelevant at this point; what’s important is that one is not necessarily ordered and the other guarantees an order.</div><div> </div></div></div></div></blockquote><div><br></div><div>What are the "two separate functionalities"? All the extension methods on Sequence are ways of spelling things that you can write in a few lines of code using a `for...in` loop; they're in the stdlib to allow a more functional style which some prefer. If you accept that a type should support iteration with a `for...in` loop, then what is your basis for claiming that these extension methods are "separate functionalities"?<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div style="overflow-wrap: break-word;"><div dir="auto" style="overflow-wrap: break-word;"><div><blockquote type="cite"><div dir="ltr" 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"><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div style="overflow-wrap: break-word;"><div><span class="gmail-m_-6771000053672623098gmail-"><blockquote type="cite"><div><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"><div>[…]</div></div></div></blockquote></span></div><span class="gmail-"><div><span class="gmail-m_-6771000053672623098gmail-"><blockquote type="cite"><div><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"><div>* 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><br></div></span>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>`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><br></div><div>Consider an Iterable that gives a different order every time it’s iterated. </div><div>Should calling `.first` or `last` give a different object every time? That’s absurd.</div><div>Should an object lexicographically compare not equal to itself? Even more absurd. </div></span></div></blockquote><span class="gmail-"><div><br></div><div>What's your basis for saying that such behavior is absurd? It is explicitly permitted for instances of types conforming to `SpongeBob` to be single-pass and/or infinite. For a single-pass `SpongeBob`, `first` will certainly return a different value every time it is invoked.</div></span></div></div></div></blockquote><div><br></div>Is `first` mutating? No. Should it be? No! `first` and `last` are a peek at the state of the object.</div></div></div></blockquote><div><br></div><div>You're right, `first` should not be mutating; that's actually an important design consideration, as Ole pointed out, and it's not actually available on `Sequence` for that reason. However, `first { _ in true }` is available and is potentially mutating, as are all methods on Sequence by design.<br></div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div style="overflow-wrap: break-word;"><div dir="auto" style="overflow-wrap: break-word;"><div>Is `elementsEqual` (or *shudder* lexicographicallyEqual) reflexive? IMO it clearly should be. Especially with the “lexicographically” part—from everything I can find, a lexicographical ordering is by definition reflexive. Do you have a citation for the idea that lexicographical equality can legitimately be non-reflexive?<span class="gmail-"><br></span></div></div></div></blockquote><div><br></div><div>Clearly (tautologically?), such a function should be reflexive for any argument ordered with respect to itself. However, if there is no lexicographical comparison possible, then a thing cannot compare lexicographically equal to anything, even itself.<br></div><div><span class="gmail-"><br><blockquote type="cite"><div dir="ltr" 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"><div class="gmail_extra"><div class="gmail_quote"><div>A random number generator fulfills all the semantic requirements of conforming to `SpongeBob`, and in fact<span class="gmail-m_-6771000053672623098Apple-converted-space"> </span><a href="https://github.com/xwu/NumericAnnex/blob/master/Sources/PRNG.swift#L53" target="_blank">I do just that in NumericAnnex</a>. `first` gives a different value every time, and a randomly generated `SpongeBob` would unsurprisingly compare lexicographically not equal to itself.</div></div></div></div></blockquote><div><br></div></span><div>> IMO that’s a bug in the implementation; lexicographical equality is reflexive, period.</div><div><br></div><div>> Presumably the `elementsEqual` method contains something along these lines (take from SequenceAlgorithms.swift.gyb):</div><span class="gmail-"><div><br></div><div><div style="margin:0px;line-height:normal;font-family:"Andale Mono";color:rgb(192,192,192);background-color:rgba(0,0,0,0.9)"><span style="font-variant-ligatures:no-common-ligatures"> </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(213,59,211)">var</span><span style="font-variant-ligatures:no-common-ligatures"> </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,187,200)">iter1</span><span style="font-variant-ligatures:no-common-ligatures"> </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,187,200)">=</span><span style="font-variant-ligatures:no-common-ligatures"> </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,187,200)">self</span><span style="font-variant-ligatures:no-common-ligatures">.makeIterator()</span></div><div style="margin:0px;line-height:normal;font-family:"Andale Mono";color:rgb(192,192,192);background-color:rgba(0,0,0,0.9)"><span style="font-variant-ligatures:no-common-ligatures"> </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(213,59,211)">var</span><span style="font-variant-ligatures:no-common-ligatures"> </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,187,200)">iter2</span><span style="font-variant-ligatures:no-common-ligatures"> </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,187,200)">=</span><span style="font-variant-ligatures:no-common-ligatures"> other.makeIterator()</span></div><div><span style="font-variant-ligatures:no-common-ligatures"><br></span></div></div></span><div>> By creating two iterators, you’re mutating while iterating. Turns out there’s even a warning against this in Sequence.swift:</div><div><br></div><div><div style="margin:0px;line-height:normal;font-family:"Andale Mono";color:rgb(92,124,245);background-color:rgba(0,0,0,0.9)"><span style="font-variant-ligatures:no-common-ligatures">/// Using Multiple Iterators</span></div><div style="margin:0px;line-height:normal;font-family:"Andale Mono";color:rgb(92,124,245);background-color:rgba(0,0,0,0.9)"><span style="font-variant-ligatures:no-common-ligatures">/// ========================</span></div><div style="margin:0px;line-height:normal;font-family:"Andale Mono";color:rgb(92,124,245);background-color:rgba(0,0,0,0.9)"><span style="font-variant-ligatures:no-common-ligatures">///</span></div><div style="margin:0px;line-height:normal;font-family:"Andale Mono";color:rgb(92,124,245);background-color:rgba(0,0,0,0.9)"><span style="font-variant-ligatures:no-common-ligatures">/// Whenever you use multiple iterators (or `for`-`in` loops) over a single</span></div><div style="margin:0px;line-height:normal;font-family:"Andale Mono";color:rgb(92,124,245);background-color:rgba(0,0,0,0.9)"><span style="font-variant-ligatures:no-common-ligatures">/// sequence, be sure you know that the specific sequence supports repeated</span></div><div style="margin:0px;line-height:normal;font-family:"Andale Mono";color:rgb(92,124,245);background-color:rgba(0,0,0,0.9)"><span style="font-variant-ligatures:no-common-ligatures">/// iteration, either because you know its concrete type or because the</span></div><div style="margin:0px;line-height:normal;font-family:"Andale Mono";color:rgb(92,124,245);background-color:rgba(0,0,0,0.9)"><span style="font-variant-ligatures:no-common-ligatures">/// sequence is also constrained to the `Collection` protocol.</span></div><div style="margin:0px;line-height:normal;font-family:"Andale Mono";color:rgb(92,124,245);background-color:rgba(0,0,0,0.9)"><span style="font-variant-ligatures:no-common-ligatures">///</span></div><div style="margin:0px;line-height:normal;font-family:"Andale Mono";color:rgb(92,124,245);background-color:rgba(0,0,0,0.9)"><span style="font-variant-ligatures:no-common-ligatures">/// Obtain each separate iterator from separate calls to the sequence's</span></div><div style="margin:0px;line-height:normal;font-family:"Andale Mono";color:rgb(92,124,245);background-color:rgba(0,0,0,0.9)"><span style="font-variant-ligatures:no-common-ligatures">/// `makeIterator()` method rather than by copying. Copying an iterator is</span></div><div style="margin:0px;line-height:normal;font-family:"Andale Mono";color:rgb(92,124,245);background-color:rgba(0,0,0,0.9)"><span style="font-variant-ligatures:no-common-ligatures">/// safe, but advancing one copy of an iterator by calling its `next()` method</span></div><div style="margin:0px;line-height:normal;font-family:"Andale Mono";color:rgb(92,124,245);background-color:rgba(0,0,0,0.9)"><span style="font-variant-ligatures:no-common-ligatures">/// may invalidate other copies of that iterator. `for`-`in` loops are safe in</span></div><div style="margin:0px;line-height:normal;font-family:"Andale Mono";color:rgb(92,124,245);background-color:rgba(0,0,0,0.9)"><span style="font-variant-ligatures:no-common-ligatures">/// this regard.</span></div><div><span style="font-variant-ligatures:no-common-ligatures"><br></span></div></div><div><b>> The default implementation of elementsEqual is therefore unsafe</b> because it has the potential for using an invalidated iterator.</div><div><br></div><div>You are misunderstanding the warning in the second paragraph here. The implementation (not a default implementation, unless I'm mistaken, as it cannot be overridden) makes each iterator using separate calls to `makeIterator()`, just as the documentation tells you to do. Calling next() on one iterator does not invalidate the other iterator, because the second is not a copy of the first.</div><div><br></div><div>You are, however, right that calling `rng.elementsEqual(rng)` is not advised. It isn't unsafe; it's just not useful. That said, calling `array.elementsEqual(array)` is equally safe and equally useless, and the uselessness of such a reflexive comparison is neither here nor there.<br></div><div><br></div><span class="gmail-"><blockquote type="cite"><div dir="ltr" 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"><div class="gmail_extra"><div class="gmail_quote"><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div style="overflow-wrap: break-word;"><div>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><br></div><div>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></blockquote><div><br></div><div>What you call a "Sequence" here would have to be multi-pass, finite, and ordered. </div></div></div></div></blockquote><div><br></div></span>> Ordered, yes, but it’s only admittedly poor wording that suggests multi-pass, and I don’t think anything there suggests finite.</div><div><br></div><div>If a Sequence is "guaranteed to iterate the same every time," then surely it must be multi-pass; what's the alternative?<br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div style="overflow-wrap: break-word;"><div dir="auto" style="overflow-wrap: break-word;"><div></div><div>It would be better to say that the iteration order is well-defined. That will almost always mean documented, and usually predictable though obviously e.g. RNGs and iterating in random order will not be predictable by design.</div><div><span class="gmail-"><br><blockquote type="cite"><div dir="ltr" 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"><div class="gmail_extra"><div class="gmail_quote"><div>That's actually more semantically constrained than what Swift calls a `Collection` (which requires conforming types to be multi-pass and(?) finite). By contrast, Swift's `SpongeBob` protocol explicitly permits conforming single-pass, infinite, and/or unordered types. </div></div></div></div></blockquote><div><br></div></span>I think you’re talking about Sequence here, I’ve lost track of your nonsense by now. Yes, the current Swift protocol named Sequence allows unordered types. You seem to keep asserting that but not actually addressing my argument, which is <b>that allowing Sequences to be unordered with the current API is undesired and actively harmful, and should</b> <b>therefore</b><b> be changed</b>.</div></div></div></blockquote><div><br></div><div>What is harmful about it?<br></div><div> <br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div style="overflow-wrap: break-word;"><div dir="auto" style="overflow-wrap: break-word;"><div><span class="gmail-"><br><blockquote type="cite"><div dir="ltr" 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"><div class="gmail_extra"><div class="gmail_quote"><div>As long as it is possible to iterate over a `SpongeBob`, it is meaningful to ask what element is first obtained upon iteration or to drop the first element obtained upon iteration.</div></div></div></div></blockquote><blockquote type="cite"><div><div dir="ltr" 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"><div class="gmail_extra"><div class="gmail_quote"><div>And as long as iteration is not required to be repeatable (and it isn't), it is perfectly acceptable for these algorithms to return a different result every time.</div></div></div></div></div></blockquote><div><br></div></span><div>It is “meaningful” in the sense that it can technically be programmed. The actual results are meaningless beyond returning or dropping a random* element.</div><div><br></div><div><div>*: Don’t nitpick the word “random”, you know exactly what I mean. It’s just shorter and no less clear than “technically more-or-less deterministic but not documented, not generally predictable, and probably but not necessarily consistent from one call to the next."</div><br></div></div></div></div></blockquote><div><br></div><div>I fail to see the issue here. If it's not providing you with utility, then don't use it. Since Collections do guarantee multi-pass iteration, Brent's example of `set.dropFirst().reduce(set.first!, ...)` provides
just one instance where an unordered Collection can profitably make use
of `first`. Permitting generic algorithms that can operate on either arrays or sets,
for example, is the desired effect of having such a protocol; a generic algorithm that takes a Collection can ask for the first element, and in the case of an unordered Collection, an arbitrary element will do just fine.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div style="overflow-wrap: break-word;"><div dir="auto" style="overflow-wrap: break-word;"><div><div><blockquote type="cite"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"></div></div></div></blockquote></div><span class="gmail-"><blockquote type="cite"><div><div dir="ltr" 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"><div class="gmail_extra"><div class="gmail_quote"><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div style="overflow-wrap: break-word;"><div>`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><br></div><div style="font-size:13px"><b>To summarize,</b></div><div>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>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><br></div><div>Just in case it’s not obvious, `Set` here is pretty much interchangeable with any other unordered iterable.</div></div></blockquote><div><br></div><div>What you want to call a "Sequence" is what Swift calls a `Collection`, with additional restrictions. What you want to be called "Iterable" is what Swift calls `Sequence` (or now, `SpongeBob`). Clearly, shuffling names will not make these protocols support any more functionality, so that can be put aside.</div></div></div></div></div></blockquote><div><br></div></span><div>No, no, no! What I want to call “Iterable” is specified below. It is about HALF of what’s currently in Sequence—the half that has to do with iterating, whence the name.</div><div>What I want to call Sequence is precisely what Swift now calls Sequence—the methods that are in Iterable by virtue of adopting Iterable, PLUS some methods that only make sense on iterable groups of objects where the iteration order is well-defined.</div><span class="gmail-"><br><blockquote type="cite"><div><div dir="ltr" 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"><div class="gmail_extra"><div class="gmail_quote"><div><br></div><div>Now, with that out of the way, why do you think that only `Collection` types should have `first` and `last`? These helper properties and methods are simply convenient ways to spell things that can be done with `for...in`--the whole point of supplying them is to allow people to work with these types in a more functional style.</div></div></div></div></div></blockquote><div><br></div></span><div>Apparently “collection" was a bad choice of word. What I clearly meant was not the current Swift Collection protocol, but rather an unordered assemblage of objects. UnorderedCollection, perhaps, or if that’s still going to cause issues, try UnorderedAssemblage. What `first` and `last` really mean in an UnorderedAssemblage is give me some object from the assembled objects, I don’t care which one. For which it’s much more clear to have an `anyObject()` as on NSSet; as another user has pointed out, `assemblage.makeIterator().<wbr>next()` works just as well. (I just checked, and that’s actually how `first` is implemented. But it’s on Collection, which is guaranteed to be multipass,)</div><span class="gmail-"></span></div></div></div></blockquote><div><br></div><div>Again, the point of having a protocol-based design is to allow useful _generic_ algorithms to be written; that `first` and `last` would be equivalent to an arbitrary element in the case that a collection is unordered is not at all an argument against these types conforming to `Collection`; if anything, it's an argument for it. Just as `Sequence.underestimatedCount` is equivalent to `Collection.count` for types that conform to `Collection`, or the instance `BinaryInteger.bitWidth` is equivalent to a static `bitWidth` for types that conform to `FixedWidthInteger`.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div style="overflow-wrap: break-word;"><div dir="auto" style="overflow-wrap: break-word;"><div><span class="gmail-"><div></div><blockquote type="cite"><div><div dir="ltr" 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"><div class="gmail_extra"><div class="gmail_quote"><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div style="overflow-wrap: break-word;"><span class="gmail-m_-6771000053672623098gmail-"><div><blockquote type="cite"><div><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"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div style="overflow-wrap: break-word;"><div dir="auto" style="overflow-wrap: break-word;"><div dir="auto" style="overflow-wrap: break-word;"><div><div><div class="gmail-m_-6771000053672623098gmail-m_2877875185135332990h5"><blockquote type="cite"><div><div><div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid 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:1px solid rgb(204,204,204);padding-left:1ex"><div style="overflow-wrap: break-word;"><div><div><div style="margin:0px;line-height:normal;font-family:"Andale Mono";color:rgb(233,175,205);background-color:rgba(0,0,0,0.9)"><span style="font-variant-ligatures:no-common-ligatures">public</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(214,214,214)"><span class="gmail-m_-6771000053672623098gmail-m_2877875185135332990Apple-converted-space"> </span></span><span style="font-variant-ligatures:no-common-ligatures">protocol</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(214,214,214)"><span class="gmail-m_-6771000053672623098gmail-m_2877875185135332990Apple-converted-space"> </span></span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,187,200)">Iterable</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(214,214,214)"><span class="gmail-m_-6771000053672623098gmail-m_2877875185135332990Apple-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.9)"><span style="font-variant-ligatures:no-common-ligatures;color:rgb(214,214,214)"> <span class="gmail-m_-6771000053672623098gmail-m_2877875185135332990Apple-converted-space"> </span></span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(205,121,35)">associatedtype</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(214,214,214)"><span class="gmail-m_-6771000053672623098gmail-m_2877875185135332990Apple-converted-space"> </span>Iterator</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(233,175,205)">:</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(214,214,214)"><span class="gmail-m_-6771000053672623098gmail-m_2877875185135332990Apple-converted-space"> </span></span><span style="font-variant-ligatures:no-common-ligatures">Ite<wbr>ratorProtocol</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.9)"><span style="font-variant-ligatures:no-common-ligatures;color:rgb(214,214,214)"> <span class="gmail-m_-6771000053672623098gmail-m_2877875185135332990Apple-converted-space"> </span></span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(233,175,205)">func</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(214,214,214)"><span class="gmail-m_-6771000053672623098gmail-m_2877875185135332990Apple-converted-space"> </span></span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,187,200)">map</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(233,175,205)"><</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,187,200)">T</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(233,175,205)">></span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(214,214,214)">(</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,187,200)">...</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(214,214,214)">)<span class="gmail-m_-6771000053672623098gmail-m_2877875185135332990Apple-converted-space"> </span></span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(233,175,205)">-></span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(214,214,214)"><span class="gmail-m_-6771000053672623098gmail-m_2877875185135332990Apple-converted-space"> </span></span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(233,175,205)">[</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,188,38)">T</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(233,175,205)">]</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(214,214,214)"><span class="gmail-m_-6771000053672623098gmail-m_2877875185135332990Apple-converted-space"> </span></span><span style="font-variant-ligatures:no-common-ligatures">// 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.9)"><span style="font-variant-ligatures:no-common-ligatures;color:rgb(214,214,214)"> <span class="gmail-m_-6771000053672623098gmail-m_2877875185135332990Apple-converted-space"> </span></span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(233,175,205)">func</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(214,214,214)"><span class="gmail-m_-6771000053672623098gmail-m_2877875185135332990Apple-converted-space"> </span></span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,187,200)">filter</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(214,214,214)">(</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,187,200)">...</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(214,214,214)">)<span class="gmail-m_-6771000053672623098gmail-m_2877875185135332990Apple-converted-space"> </span></span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(233,175,205)">-></span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(214,214,214)"><span class="gmail-m_-6771000053672623098gmail-m_2877875185135332990Apple-converted-space"> </span></span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(233,175,205)">[</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,188,38)">Iterato<wbr>r.Element</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(233,175,205)">]</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(214,214,214)"><span class="gmail-m_-6771000053672623098gmail-m_2877875185135332990Apple-converted-space"> </span></span><span style="font-variant-ligatures:no-common-ligatures">// 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.9)"><span style="font-variant-ligatures:no-common-ligatures;color:rgb(214,214,214)"> <span class="gmail-m_-6771000053672623098gmail-m_2877875185135332990Apple-converted-space"> </span></span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(233,175,205)">func</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(214,214,214)"><span class="gmail-m_-6771000053672623098gmail-m_2877875185135332990Apple-converted-space"> </span></span><span style="font-variant-ligatures:no-common-ligatures">forEach</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(214,214,214)">(</span><span style="font-variant-ligatures:no-common-ligatures">...</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(214,214,214)">)</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.9)"><span style="font-variant-ligatures:no-common-ligatures;color:rgb(214,214,214)"> <span class="gmail-m_-6771000053672623098gmail-m_2877875185135332990Apple-converted-space"> </span></span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(233,175,205)">func</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(214,214,214)"><span class="gmail-m_-6771000053672623098gmail-m_2877875185135332990Apple-converted-space"> </span></span><span style="font-variant-ligatures:no-common-ligatures">makeIterator</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(214,214,214)">()<span class="gmail-m_-6771000053672623098gmail-m_2877875185135332990Apple-converted-space"> </span></span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(233,175,205)">-></span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(214,214,214)"><span class="gmail-m_-6771000053672623098gmail-m_2877875185135332990Apple-converted-space"> </span></span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,188,38)">Itera<wbr>tor</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.9)"><span style="font-variant-ligatures:no-common-ligatures;color:rgb(214,214,214)"> <span class="gmail-m_-6771000053672623098gmail-m_2877875185135332990Apple-converted-space"> </span></span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(233,175,205)">var</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(214,214,214)"><span class="gmail-m_-6771000053672623098gmail-m_2877875185135332990Apple-converted-space"> </span></span><span style="font-variant-ligatures:no-common-ligatures">underestimatedCount</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(233,175,205)">:</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(214,214,214)"><span class="gmail-m_-6771000053672623098gmail-m_2877875185135332990Apple-converted-space"> </span></span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,188,38)">Int</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(214,214,214)"><span class="gmail-m_-6771000053672623098gmail-m_2877875185135332990Apple-converted-space"><wbr> </span>{<span class="gmail-m_-6771000053672623098gmail-m_2877875185135332990Apple-converted-space"> </span></span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(205,121,35)">get</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(214,214,214)"><span class="gmail-m_-6771000053672623098gmail-m_2877875185135332990Apple-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.9)"><span style="font-variant-ligatures:no-common-ligatures">}</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.9);min-height:14px"><span style="font-variant-ligatures:no-common-ligatures"></span><br></div><div style="margin:0px;line-height:normal;font-family:"Andale Mono";color:rgb(130,185,255);background-color:rgba(0,0,0,0.9)"><span style="font-variant-ligatures:no-common-ligatures;color:rgb(233,175,205)">public</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(214,214,214)"><span class="gmail-m_-6771000053672623098gmail-m_2877875185135332990Apple-converted-space"> </span></span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(233,175,205)">protocol</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(214,214,214)"><span class="gmail-m_-6771000053672623098gmail-m_2877875185135332990Apple-converted-space"> </span></span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,187,200)">Sequence</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(233,175,205)">:</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(214,214,214)"><span class="gmail-m_-6771000053672623098gmail-m_2877875185135332990Apple-converted-space"> </span></span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,188,38)">Iter<wbr>able</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(214,214,214)"><span class="gmail-m_-6771000053672623098gmail-m_2877875185135332990Apple-converted-space"> </span>{<span class="gmail-m_-6771000053672623098gmail-m_2877875185135332990Apple-converted-space"> </span></span><span style="font-variant-ligatures:no-common-ligatures">// 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.9)"><span style="font-variant-ligatures:no-common-ligatures"> <span class="gmail-m_-6771000053672623098gmail-m_2877875185135332990Apple-converted-space"> </span></span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(205,121,35)">associatedtype</span><span style="font-variant-ligatures:no-common-ligatures"><span class="gmail-m_-6771000053672623098gmail-m_2877875185135332990Apple-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.9)"><span style="font-variant-ligatures:no-common-ligatures;color:rgb(214,214,214)"> <span class="gmail-m_-6771000053672623098gmail-m_2877875185135332990Apple-converted-space"> </span></span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(233,175,205)">func</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(214,214,214)"><span class="gmail-m_-6771000053672623098gmail-m_2877875185135332990Apple-converted-space"> </span></span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,187,200)">dropFirst</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(214,214,214)">(</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,187,200)">...</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(214,214,214)">) <span class="gmail-m_-6771000053672623098gmail-m_2877875185135332990Apple-converted-space"> </span></span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(233,175,205)">-></span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(214,214,214)"><span class="gmail-m_-6771000053672623098gmail-m_2877875185135332990Apple-converted-space"> </span></span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,188,38)">SubSequence</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(214,214,214)"><span class="gmail-m_-6771000053672623098gmail-m_2877875185135332990Apple-converted-space"> </span> <span class="gmail-m_-6771000053672623098gmail-m_2877875185135332990Apple-converted-space"> </span></span><span style="font-variant-ligatures:no-common-ligatures">// 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.9)"><span style="font-variant-ligatures:no-common-ligatures"> <span class="gmail-m_-6771000053672623098gmail-m_2877875185135332990Apple-converted-space"> </span></span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(233,175,205)">func</span><span style="font-variant-ligatures:no-common-ligatures"><span class="gmail-m_-6771000053672623098gmail-m_2877875185135332990Apple-converted-space"> </span></span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,187,200)">dropLast</span><span style="font-variant-ligatures:no-common-ligatures">(</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,187,200)">...</span><span style="font-variant-ligatures:no-common-ligatures">) <span class="gmail-m_-6771000053672623098gmail-m_2877875185135332990Apple-converted-space"> </span></span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(233,175,205)">-></span><span style="font-variant-ligatures:no-common-ligatures"><span class="gmail-m_-6771000053672623098gmail-m_2877875185135332990Apple-converted-space"> </span></span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,188,38)">SubSequence</span><span style="font-variant-ligatures:no-common-ligatures"><span class="gmail-m_-6771000053672623098gmail-m_2877875185135332990Apple-converted-space"> </span> <span class="gmail-m_-6771000053672623098gmail-m_2877875185135332990Apple-converted-space"> </span></span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(130,185,255)">// " "</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.9)"><span style="font-variant-ligatures:no-common-ligatures"> <span class="gmail-m_-6771000053672623098gmail-m_2877875185135332990Apple-converted-space"> </span></span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(233,175,205)">func</span><span style="font-variant-ligatures:no-common-ligatures"><span class="gmail-m_-6771000053672623098gmail-m_2877875185135332990Apple-converted-space"> </span></span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,187,200)">drop</span><span style="font-variant-ligatures:no-common-ligatures">(</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(205,121,35)">while</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,187,200)">...</span><span style="font-variant-ligatures:no-common-ligatures">) <span class="gmail-m_-6771000053672623098gmail-m_2877875185135332990Apple-converted-space"> </span></span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(233,175,205)">-></span><span style="font-variant-ligatures:no-common-ligatures"><span class="gmail-m_-6771000053672623098gmail-m_2877875185135332990Apple-converted-space"> </span></span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,188,38)">SubSequence</span><span style="font-variant-ligatures:no-common-ligatures"><span class="gmail-m_-6771000053672623098gmail-m_2877875185135332990Apple-converted-space"> </span> <span class="gmail-m_-6771000053672623098gmail-m_2877875185135332990Apple-converted-space"> </span></span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(130,185,255)">// " "</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.9)"><span style="font-variant-ligatures:no-common-ligatures"> <span class="gmail-m_-6771000053672623098gmail-m_2877875185135332990Apple-converted-space"> </span></span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(233,175,205)">func</span><span style="font-variant-ligatures:no-common-ligatures"><span class="gmail-m_-6771000053672623098gmail-m_2877875185135332990Apple-converted-space"> </span></span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,187,200)">prefix</span><span style="font-variant-ligatures:no-common-ligatures">(</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,187,200)">...</span><span style="font-variant-ligatures:no-common-ligatures">) <span class="gmail-m_-6771000053672623098gmail-m_2877875185135332990Apple-converted-space"> </span></span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(233,175,205)">-></span><span style="font-variant-ligatures:no-common-ligatures"><span class="gmail-m_-6771000053672623098gmail-m_2877875185135332990Apple-converted-space"> </span></span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,188,38)">SubSequence</span><span style="font-variant-ligatures:no-common-ligatures"><span class="gmail-m_-6771000053672623098gmail-m_2877875185135332990Apple-converted-space"> </span> <span class="gmail-m_-6771000053672623098gmail-m_2877875185135332990Apple-converted-space"> </span></span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(130,185,255)">// " "</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.9)"><span style="font-variant-ligatures:no-common-ligatures;color:rgb(214,214,214)"> <span class="gmail-m_-6771000053672623098gmail-m_2877875185135332990Apple-converted-space"> </span></span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(233,175,205)">func</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(214,214,214)"><span class="gmail-m_-6771000053672623098gmail-m_2877875185135332990Apple-converted-space"> </span></span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,187,200)">prefix</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(214,214,214)">(</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(205,121,35)">while</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,187,200)">...</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(214,214,214)">)<span class="gmail-m_-6771000053672623098gmail-m_2877875185135332990Apple-converted-space"> </span></span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(233,175,205)">-></span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(214,214,214)"><span class="gmail-m_-6771000053672623098gmail-m_2877875185135332990Apple-converted-space"> </span></span><span style="font-variant-ligatures:no-common-ligatures">Sub<wbr>Sequence</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(214,214,214)"><span class="gmail-m_-6771000053672623098gmail-m_2877875185135332990Apple-converted-space"> </span> <span class="gmail-m_-6771000053672623098gmail-m_2877875185135332990Apple-converted-space"> </span></span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(130,185,255)">// " "</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.9)"><span style="font-variant-ligatures:no-common-ligatures"> <span class="gmail-m_-6771000053672623098gmail-m_2877875185135332990Apple-converted-space"> </span></span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(233,175,205)">func</span><span style="font-variant-ligatures:no-common-ligatures"><span class="gmail-m_-6771000053672623098gmail-m_2877875185135332990Apple-converted-space"> </span></span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,187,200)">suffix</span><span style="font-variant-ligatures:no-common-ligatures">(</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,187,200)">...</span><span style="font-variant-ligatures:no-common-ligatures">) <span class="gmail-m_-6771000053672623098gmail-m_2877875185135332990Apple-converted-space"> </span></span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(233,175,205)">-></span><span style="font-variant-ligatures:no-common-ligatures"><span class="gmail-m_-6771000053672623098gmail-m_2877875185135332990Apple-converted-space"> </span></span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,188,38)">SubSequence</span><span style="font-variant-ligatures:no-common-ligatures"><span class="gmail-m_-6771000053672623098gmail-m_2877875185135332990Apple-converted-space"> </span> <span class="gmail-m_-6771000053672623098gmail-m_2877875185135332990Apple-converted-space"> </span></span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(130,185,255)">// " "</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.9)"><span style="font-variant-ligatures:no-common-ligatures;color:rgb(214,214,214)"> <span class="gmail-m_-6771000053672623098gmail-m_2877875185135332990Apple-converted-space"> </span></span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(233,175,205)">func</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(214,214,214)"><span class="gmail-m_-6771000053672623098gmail-m_2877875185135332990Apple-converted-space"> </span></span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,187,200)">split</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(214,214,214)">(</span><span style="color:rgb(52,187,200)">...</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(205,121,35)">where</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,187,200)">...</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(214,214,214)">) <span class="gmail-m_-6771000053672623098gmail-m_2877875185135332990Apple-converted-space"> </span></span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(233,175,205)">-></span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(214,214,214)"><span class="gmail-m_-6771000053672623098gmail-m_2877875185135332990Apple-converted-space"> </span></span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(233,175,205)"><wbr>[</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,188,38)">SubSequence</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(233,175,205)">]</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(214,214,214)"><span class="gmail-m_-6771000053672623098gmail-m_2877875185135332990Apple-converted-space"> </span></span><span style="font-variant-ligatures:no-common-ligatures">// 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.9)"><span style="font-variant-ligatures:no-common-ligatures">}</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><br></div></span>And just to be explicit, <div>struct Set: Iterable {…}</div><div>struct Dictionary: Iterable {…}</div><div>struct Array: Sequence {…}</div><div>etc.</div><div><br></div><div>Hopefully at some point:</div><div>struct OrderedSet: Sequence {…}</div></div></blockquote></div></div></div></div></blockquote></span></div><br></div></div></blockquote></div><br></div></div>