<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Jan 4, 2016 at 2:21 PM, Tony Parker via swift-dev <span dir="ltr">&lt;<a href="mailto:swift-dev@swift.org" target="_blank">swift-dev@swift.org</a>&gt;</span> wrote:<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"><div style="word-wrap:break-word">Hi Mark,<div><br></div><div>I’m going to loop in the swift-dev list for this question.</div></div></blockquote><div><br></div><div>Thanks, Tony!</div><div> </div><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"><div style="word-wrap:break-word"><div><div><blockquote type="cite"><div><div class="h5"><div>On Jan 4, 2016, at 5:15 AM, Mark Aron Szulyovszky via swift-corelibs-dev &lt;<a href="mailto:swift-corelibs-dev@swift.org" target="_blank">swift-corelibs-dev@swift.org</a>&gt; wrote:</div><br></div></div><div><div><div class="h5"><div dir="ltr">Hi,<div><div><div dir="ltr"></div></div></div>
<div><br></div><div>I came across hit issue while chaining filter() and prefix() on lazy sequences:</div><div><a href="https://bugs.swift.org/browse/SR-461" target="_blank">https://bugs.swift.org/browse/SR-461</a><br></div><div><br></div><div>And started wondering if it would be more consistent if lazy.filter().prefix() returned a custom LazySequenceType&lt;Generator.Element&gt; instead of Slice&lt;LazyFilterCollection&lt;Range&lt;Generator.Element&gt;&gt;&gt;.</div><div><br></div><div>That way lazy.filter().prefix() could be used to chain <b>pure lazy operations</b>, which can be actually quite useful in some cases.</div></div></div></div></div></blockquote></div></div></div></blockquote><div><br></div><div>Hi Mark,</div><div><br></div><div>I think this would make a lot of sense, since the lazy implementation of prefix() would allow the operation to be performed in O(1) instead of triggering the whole calculation chain.  But for random-access collections, keeping the current implementation would be best, I think.  Would you mind sending a quick summary of the proposed new API to swift-evolution?  That mailing list is the preferred place for such discussions.  You can read more about it here: <a href="https://github.com/apple/swift-evolution/blob/master/process.md">https://github.com/apple/swift-evolution/blob/master/process.md</a></div><div><br></div><div>The ambiguity issue that you are seeing, I think, should be viewed as a type checker issue and should be solved separately.</div></div><br>Dmitri<br clear="all"><div><br></div>-- <br><div class="gmail_signature">main(i,j){for(i=2;;i++){for(j=2;j&lt;i;j++){if(!(i%j)){j=0;break;}}if<br>(j){printf(&quot;%d\n&quot;,i);}}} /*Dmitri Gribenko &lt;<a href="mailto:gribozavr@gmail.com" target="_blank">gribozavr@gmail.com</a>&gt;*/</div>
</div></div>