I didn&#39;t explain correctly.<div><br></div><div>let&#39;s take this:</div><div><span style="background-color:rgba(255,255,255,0);font-size:small"><br></span></div><div><span style="background-color:rgba(255,255,255,0);font-size:small">let </span><span style="background-color:rgba(255,255,255,0);font-size:small">c = Multipass(Fib(a: 1, b: -1, limit: 10))</span></div><div><span style="background-color:rgba(255,255,255,0);font-size:small"><br></span></div><div><span style="background-color:rgba(255,255,255,0);font-size:small">this sequences should have results with [1, -1, 0, -1, -1, ...]</span></div><div><span style="background-color:rgba(255,255,255,0);font-size:small">So is c.startIndex.successor() equal to </span><font size="2"><span style="background-color:rgba(255,255,255,0)">c.startIndex.successor().successor().successor()??<span></span></span></font></div><div><br>Dave Abrahams &lt;<a href="mailto:dabrahams@apple.com">dabrahams@apple.com</a>&gt; 於 2016年1月1日星期五 寫道:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><br><div><blockquote type="cite"><div>On Dec 31, 2015, at 8:22 PM, 鄭齊峯 via swift-evolution &lt;<a href="javascript:_e(%7B%7D,&#39;cvml&#39;,&#39;swift-evolution@swift.org&#39;);" target="_blank">swift-evolution@swift.org</a>&gt; wrote:</div><br><div><span style="font-family:AvenirNext-Medium;font-size:15px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;float:none;display:inline!important">if you try my modification, it will crash.</span></div></blockquote><div><br></div>Only because your Sequence genereates an arithmetic underflow.  I don’t understand what point you’re trying to make</div><div><blockquote type="cite"><div><div style="font-family:AvenirNext-Medium;font-size:15px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><br><div><div style="font-size:14px">struct Fib : SequenceType {</div><div style="font-size:14px">    </div><div style="font-size:14px">    var a: Int</div><div style="font-size:14px">    var b: Int</div><div style="font-size:14px">    </div><div style="font-size:14px">    var limit: Int</div><div style="font-size:14px">    </div><div style="font-size:14px">    func generate() -&gt; FibGenerator {</div><div style="font-size:14px">        return Generator(a: a, b: b, limit: limit)</div><div style="font-size:14px">    }</div><div style="font-size:14px">}</div><div style="font-size:14px"><br></div><div><span style="font-size:14px">let c = Multipass(Fib(a: 1, b: -1, limit: 10))</span><br></div><div><span style="font-size:14px"><br></span></div><div><span style="font-size:14px">A SequenceType becomes a CollectionType only work by adding a Index. that the most significantly different of sequence and collection.</span></div></div></div></div></blockquote><div><br></div>I think I understand that pretty well, having designed both of those abstractions, but still don’t get your point.  Sorry, I’m trying here, but I can’t figure out what you’re trying to tell me.</div><div><br><blockquote type="cite"><div><div style="font-family:AvenirNext-Medium;font-size:15px;font-style: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 style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo;min-height:13px"><br></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,132,0)">/// A `CollectionType` containing the same elements as `Base`, without storing them.</div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,132,0)">///</div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,132,0)">/// - Requires: `Base` supports multiple passes (traversing it does not</div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,132,0)">///   consume the sequence), and `Base.Generator` has value semantics</div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo"><span style="color:rgb(187,44,162)">public</span> <span style="color:rgb(187,44,162)">struct</span> Multipass&lt;Base: SequenceType&gt; : <span style="color:rgb(112,61,170)">CollectionType</span> {</div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo">    <span style="color:rgb(187,44,162)">public</span> <span style="color:rgb(187,44,162)">var</span> startIndex: <span style="color:rgb(79,129,135)">MultipassIndex</span>&lt;<span style="color:rgb(112,61,170)">Base</span>&gt; {</div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo">        <span style="color:rgb(187,44,162)">var</span> g = <span style="color:rgb(79,129,135)">_base</span>.<span style="color:rgb(61,29,129)">enumerate</span>().<span style="color:rgb(61,29,129)">generate</span>()</div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo">        <span style="color:rgb(187,44,162)">if</span> <span style="color:rgb(187,44,162)">let</span> (idx, val) = g.<span style="color:rgb(61,29,129)">next</span>() {</div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo">            <span style="color:rgb(187,44,162)">return</span> <span style="color:rgb(79,129,135)">MultipassIndex</span>(index: idx, buffer: val, generator: g)</div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo">        }</div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo">        <span style="color:rgb(187,44,162)">return</span> <span style="color:rgb(79,129,135)">MultipassIndex</span>(index: <span style="color:rgb(187,44,162)">nil</span>, buffer: <span style="color:rgb(187,44,162)">nil</span>, generator: g)</div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo">    }</div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo;min-height:13px">    <br></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo">    <span style="color:rgb(187,44,162)">public</span> <span style="color:rgb(187,44,162)">var</span> endIndex: <span style="color:rgb(79,129,135)">MultipassIndex</span>&lt;<span style="color:rgb(112,61,170)">Base</span>&gt; {</div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo">        <span style="color:rgb(187,44,162)">return</span> <span style="color:rgb(79,129,135)">MultipassIndex</span>(index: <span style="color:rgb(187,44,162)">nil</span>, buffer: <span style="color:rgb(187,44,162)">nil</span>, generator: <span style="color:rgb(79,129,135)">_base</span>.<span style="color:rgb(61,29,129)">enumerate</span>().<span style="color:rgb(61,29,129)">generate</span>())</div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo">    }</div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo;min-height:13px">    <br></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo">    <span style="color:rgb(187,44,162)">public</span> <span style="color:rgb(187,44,162)">subscript</span>(position: <span style="color:rgb(79,129,135)">MultipassIndex</span>&lt;<span style="color:rgb(112,61,170)">Base</span>&gt;) -&gt; <span style="color:rgb(112,61,170)">Base</span>.<span style="color:rgb(112,61,170)">Generator</span>.<span style="color:rgb(112,61,170)">Element</span> {</div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo">        <span style="color:rgb(187,44,162)">return</span> position.<span style="color:rgb(79,129,135)">buffer</span>!</div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo">    }</div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo;min-height:13px">    <br></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo">    <span style="color:rgb(187,44,162)">public</span> <span style="color:rgb(187,44,162)">init</span>(<span style="color:rgb(187,44,162)">_</span> base: <span style="color:rgb(112,61,170)">Base</span>) {</div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo">        <span style="color:rgb(79,129,135)">_base</span> = base</div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo">    }</div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo;min-height:13px">    <br></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo">    <span style="color:rgb(187,44,162)">var</span> _base: <span style="color:rgb(112,61,170)">Base</span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo">}</div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo;min-height:13px"><br></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,132,0)">// Note: Requires T.Generator has value semantics</div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo"><span style="color:rgb(187,44,162)">public</span> <span style="color:rgb(187,44,162)">struct</span> MultipassIndex&lt;T: SequenceType&gt; : <span style="color:rgb(112,61,170)">ForwardIndexType</span> {</div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo">    <span style="color:rgb(187,44,162)">public</span> <span style="color:rgb(187,44,162)">func</span> successor() -&gt; <span style="color:rgb(79,129,135)">MultipassIndex</span> {</div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo">        <span style="color:rgb(187,44,162)">var</span> r = <span style="color:rgb(187,44,162)">self</span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo">        <span style="color:rgb(187,44,162)">if</span> <span style="color:rgb(187,44,162)">let</span> (idx, val) = r.<span style="color:rgb(79,129,135)">generator</span>.<span style="color:rgb(61,29,129)">next</span>() {</div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo">            r.<span style="color:rgb(79,129,135)">index</span> = idx</div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo">            r.<span style="color:rgb(79,129,135)">buffer</span> = val</div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo">        } <span style="color:rgb(187,44,162)">else</span> {</div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo">            r.<span style="color:rgb(79,129,135)">index</span> = <span style="color:rgb(187,44,162)">nil</span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo">            r.<span style="color:rgb(79,129,135)">buffer</span> = <span style="color:rgb(187,44,162)">nil</span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo">        }</div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo">        <span style="color:rgb(187,44,162)">return</span> r</div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo">    }</div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo">    <span style="color:rgb(187,44,162)">var</span> index: <span style="color:rgb(112,61,170)">Int</span>?</div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(112,61,170)"><span>    </span><span style="color:rgb(187,44,162)">var</span><span> buffer: </span>T<span>.</span>Generator<span>.</span>Element<span>?</span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(112,61,170)"><span>    </span><span style="color:rgb(187,44,162)">var</span><span> generator: </span>EnumerateSequence<span>&lt;</span>T<span>&gt;.</span>Generator</div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo">}</div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo;min-height:13px"><br></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo"><span style="color:rgb(187,44,162)">public</span> <span style="color:rgb(187,44,162)">func</span> == &lt;T&gt;(x: <span style="color:rgb(79,129,135)">MultipassIndex</span>&lt;<span style="color:rgb(112,61,170)">T</span>&gt;, y: <span style="color:rgb(79,129,135)">MultipassIndex</span>&lt;<span style="color:rgb(112,61,170)">T</span>&gt;) -&gt; <span style="color:rgb(112,61,170)">Bool</span> {</div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo">    <span style="color:rgb(187,44,162)">return</span> x.<span style="color:rgb(79,129,135)">index</span> == y.<span style="color:rgb(79,129,135)">index</span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo">}</div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo;min-height:13px"><br></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,132,0)">//===--- An example fibonacci sequence ------------------------------------===//</div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo"><span style="color:rgb(187,44,162)">struct</span> FibGenerator : <span style="color:rgb(112,61,170)">GeneratorType</span> {</div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo">    <span style="color:rgb(187,44,162)">mutating</span> <span style="color:rgb(187,44,162)">func</span> next() -&gt; <span style="color:rgb(112,61,170)">Int</span>? {</div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo">        <span style="color:rgb(187,44,162)">let</span> c = <span style="color:rgb(79,129,135)">a</span> + <span style="color:rgb(79,129,135)">b</span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo">        <span style="color:rgb(79,129,135)">a</span> = <span style="color:rgb(79,129,135)">b</span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo">        <span style="color:rgb(79,129,135)">b</span> = c</div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo">        <span style="color:rgb(187,44,162)">return</span> <span style="color:rgb(79,129,135)">a</span> &lt; <span style="color:rgb(79,129,135)">limit</span> ? <span style="color:rgb(79,129,135)">a</span> : <span style="color:rgb(187,44,162)">nil</span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo">    }</div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo">    <span style="color:rgb(187,44,162)">var</span> a, b, limit: <span style="color:rgb(112,61,170)">Int</span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo">}</div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo;min-height:13px"><br></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo;min-height:13px"><br></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(112,61,170)"><span style="color:rgb(187,44,162)">struct</span><span> Fib : </span>SequenceType<span> {</span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo">    <span style="color:rgb(187,44,162)">var</span> limit = <span style="color:rgb(39,42,216)">100</span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo;min-height:13px">    <br></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo">    <span style="color:rgb(187,44,162)">func</span> generate() -&gt; <span style="color:rgb(79,129,135)">FibGenerator</span> {</div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo">        <span style="color:rgb(187,44,162)">return</span> <span style="color:rgb(79,129,135)">Generator</span>(a: <span style="color:rgb(39,42,216)">0</span>, b: <span style="color:rgb(39,42,216)">1</span>, limit: <span style="color:rgb(79,129,135)">limit</span>)</div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo">    }</div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo">}</div></div><div><br></div></div></div><div style="font-family:AvenirNext-Medium;font-size:15px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">It&#39;s true that <span style="color:rgb(112,61,170);font-family:Menlo;font-size:11px">ForwardIndexType</span> is also run-through the base one by one but it also correct that getting specific value with specific index.</div><div style="font-family:AvenirNext-Medium;font-size:15px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><br></div><div style="font-family:AvenirNext-Medium;font-size:15px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(49,89,93)"><span style="color:rgb(79,129,135)">c</span>[<span style="color:rgb(79,129,135)">c</span><span>.</span><span style="color:rgb(79,129,135)">startIndex</span><span>.</span>successor<span>().</span>successor<span>().</span>successor<span>()</span>] // it&#39;s a defined behave</div></div></div></blockquote><div><br></div>Again, not sure what you’re trying to say here.</div><div><br><blockquote type="cite"><div><div style="font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;margin:0px;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(49,89,93)"><br></div><div style="font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;margin:0px;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(49,89,93)"><br></div><div style="font-family:AvenirNext-Medium;font-size:15px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><blockquote type="cite"><div>Dave Abrahams &lt;<a href="javascript:_e(%7B%7D,&#39;cvml&#39;,&#39;dabrahams@apple.com&#39;);" target="_blank">dabrahams@apple.com</a>&gt; 於 2016年1月1日 下午12:00 寫道:</div><br><div><div style="font-family:Helvetica;font-size:12px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><blockquote type="cite"><div><br>On Dec 31, 2015, at 7:46 PM, Susan Cheng &lt;<a href="javascript:_e(%7B%7D,&#39;cvml&#39;,&#39;susan.doggie@gmail.com&#39;);" target="_blank">susan.doggie@gmail.com</a>&gt; wrote:</div><br><div><div dir="ltr"><div><br></div><div>How GeneratorType confirm to Equatable??</div></div></div></blockquote><div><br></div>I don’t understand the question.  In the code I posted there’s a working example of how a GeneratorType model can conform to Equatable..</div><div style="font-family:Helvetica;font-size:12px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><br><blockquote type="cite"><div><div dir="ltr"><div><br></div><div>struct Fib : SequenceType {</div><div>    </div><div>    var a: Int</div><div>    var b: Int</div><div>    </div><div>    var limit: Int</div><div>    </div><div>    func generate() -&gt; FibGenerator {</div><div>        return Generator(a: a, b: b, limit: limit)</div><div>    }</div><div>}</div><div><br></div><div>let c = Multipass(Fib(a: 1, b: -1, limit: 10))</div><div><br></div><div>-Susan</div><div><br></div><div class="gmail_extra"><br><div class="gmail_quote">2016-01-01 11:17 GMT+08:00 Dave Abrahams<span> </span><span dir="ltr">&lt;<a href="javascript:_e(%7B%7D,&#39;cvml&#39;,&#39;dabrahams@apple.com&#39;);" target="_blank">dabrahams@apple.com</a>&gt;</span>:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">FWIW, Indexable is an implementation artifact that will go away when Swift’s generics system is improved.<br><br>But if your real objection is that you have to come up with an Index and a subscripting operator, I can understand that.  Part of the reason for this is our reluctance to create any distinct protocols with identical syntactic requirements &lt;<a href="http://news.gmane.org/find-root.php?message_id=2A3E0C76-1C88-4752-8A70-AA64BB14223A@apple.com" rel="noreferrer" target="_blank">http://news.gmane.org/find-root.php?message_id=2A3E0C76-1C88-4752-8A70-AA64BB14223A@apple.com</a>&gt;.  To justify having a separate multi-pass sequence protocol, there would have to be a significant/important class of multi-pass sequences for which CollectionType was unimplementable without serious costs.<br><br>In principle there’s a way to ease the pain of creating CollectionType conformances for multipass SequenceTypes…if only it didn’t crash the compiler &lt;<a href="https://bugs.swift.org/browse/SR-427" rel="noreferrer" target="_blank">https://bugs.swift.org/browse/SR-427</a>&gt; ;-).  Here’s a variation that uses a generic adapter instead of a protocol conformance declaration:<br><br>/// A `CollectionType` containing the same elements as `Base`, without storing them.<br>///<br>/// - Requires: `Base` supports multiple passes (traversing it does not<br>///   consume the sequence), and `Base.Generator` has value semantics<br>public struct Multipass&lt;Base: SequenceType where Base.Generator: Equatable&gt; : CollectionType {<br>  public var startIndex: MultipassIndex&lt;Base&gt; {<br>    var g = _base.generate()<br>    return MultipassIndex(buffer: g.next(), generator: g)<br>  }<br><br>  public var endIndex: MultipassIndex&lt;Base&gt; {<br>    return MultipassIndex(buffer: nil, generator: _base.generate())<br>  }<br><br>  public subscript(position: MultipassIndex&lt;Base&gt;) -&gt; Base.Generator.Element {<br>    return position.buffer!<br>  }<br><br>  public init(_ base: Base) {<br>    _base = base<br>  }<br><br>  var _base: Base<br>}<br><br>// Note: Requires T.Generator has value semantics<br>public struct MultipassIndex&lt;T: SequenceType where T.Generator: Equatable&gt; : ForwardIndexType {<br>  public func successor() -&gt; MultipassIndex {<br>    var r = self<br>    r.buffer = r.generator.next()<br>    return r<br>  }<br>  var buffer: T.Generator.Element?<br>  var generator: T.Generator<br>}<br><br>public func == &lt;T&gt;(x: MultipassIndex&lt;T&gt;, y: MultipassIndex&lt;T&gt;) -&gt; Bool {<br>  return x.buffer == nil &amp;&amp; y.buffer == nil || x.generator == y.generator<br>}<br><br>//===--- An example fibonacci sequence ------------------------------------===//<br>struct FibGenerator : GeneratorType {<br>  mutating func next() -&gt; Int? {<br>    let c = a + b<br>    a = b<br>    b = c<br>    return a &lt; limit ? a : nil<br>  }<br>  var a, b, limit: Int<br>}<br><br><br>struct Fib : SequenceType {<br>  var limit = 1000<br><br>  func generate() -&gt; FibGenerator {<br>    return Generator(a: 0, b: 1, limit: limit)<br>  }<br>}<br><br>//===--- Adapt Fib for use with Multipass ---------------------------------===//<br>extension FibGenerator : Equatable {}<br>func == (x: Fib.Generator, y: Fib.Generator) -&gt; Bool {<br>  return x.a == y.a<br>}<br><br>//===--- Demonstration ----------------------------------------------------===//<br>let c = Multipass(Fib())<br>print(c.first)<br>print(c.count)<br>print(c.lazy.map { $0 + 1 })<br></blockquote></div><br></div></div></div></blockquote></div><br style="font-family:Helvetica;font-size:12px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><div style="font-family:Helvetica;font-size:12px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">-Dave</div></div></blockquote></div><br style="font-family:AvenirNext-Medium;font-size:15px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><img src="https://u2002410.ct.sendgrid.net/wf/open?upn=JfMPa-2F7wwZPzsZ3QKA8NjtONIYX4SjbWuUxtpfsTY2iUag6Z9T-2BqnrsD8bD7y5-2BwDLHvVHWyCxrqs-2BCIjfPaLjobBqm7cY1WQl-2BrQDc-2BOJX1jkgJnRxMlpgGZ2bampgnhGR9dZy8ODz-2B7c3KVgCDEFZF5bhuC4V8AjfQ8rJBU3q1z8tHXx6SdJ5BJArqzxRShi8fy3KF6qRPQAMqHoL1FXY0Y6gZLA1Slikovs8fdpA-3D" alt="" width="1" height="1" border="0" style="font-family:AvenirNext-Medium;font-size:15px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;min-height:1px!important;width:1px!important;border-width:0px!important;margin:0px!important;padding:0px!important"><span style="font-family:AvenirNext-Medium;font-size:15px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;float:none;display:inline!important"><span> </span></span><span style="font-family:AvenirNext-Medium;font-size:15px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;float:none;display:inline!important">_______________________________________________</span><br style="font-family:AvenirNext-Medium;font-size:15px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><span style="font-family:AvenirNext-Medium;font-size:15px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;float:none;display:inline!important">swift-evolution mailing list</span><br style="font-family:AvenirNext-Medium;font-size:15px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><a href="javascript:_e(%7B%7D,&#39;cvml&#39;,&#39;swift-evolution@swift.org&#39;);" style="font-family:AvenirNext-Medium;font-size:15px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" target="_blank">swift-evolution@swift.org</a><br style="font-family:AvenirNext-Medium;font-size:15px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" style="font-family:AvenirNext-Medium;font-size:15px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a></div></blockquote></div><br><div>
-Dave
</div>
<br></div></blockquote></div>