<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Sun, Dec 6, 2015 at 3:34 PM, Erica Sadun via swift-evolution <span dir="ltr"><<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>></span> wrote:<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"><div>It's pretty easy to build your own Zips. Not sure the language really needs this. For example, I recently built a zip that produces (T?, T?) which fills one of the two with nil until both lists are consumed:</div><div><br></div><div><div style="margin:0px;font-size:18px;line-height:normal;font-family:Menlo;color:rgb(112,61,170)"><div style="margin:0px;line-height:normal"><span style="color:#bb2ca2">func</span> longZip<S0: SequenceType, S1: SequenceType>(seq0: S0, <span style="color:#bb2ca2">_</span> seq1: S1) -></div><div style="margin:0px;line-height:normal"><span style="color:#000000"> </span>AnyGenerator<span style="color:#000000"><(</span>S0<span style="color:#000000">.</span>Generator<span style="color:#000000">.</span>Element<span style="color:#000000">?, </span>S1<span style="color:#000000">.</span>Generator<span style="color:#000000">.</span>Element<span style="color:#000000">?)> {</span></div></div></div></div></blockquote><div><br></div><div><br></div><div></div></div><div class="gmail_extra">Just wanted to point out that AnyGenerator has an inherent cost from the type erasure. The implementation in the standard library uses generics and is fully optimizable.</div><div class="gmail_extra"><br></div><div class="gmail_extra">Dmitri</div><div><br></div>-- <br><div class="gmail_signature">main(i,j){for(i=2;;i++){for(j=2;j<i;j++){if(!(i%j)){j=0;break;}}if<br>(j){printf("%d\n",i);}}} /*Dmitri Gribenko <<a href="mailto:gribozavr@gmail.com" target="_blank">gribozavr@gmail.com</a>>*/</div>
</div></div>