[swift-evolution] zip3, zip4, ...

Dmitri Gribenko gribozavr at gmail.com
Sun Dec 6 17:37:03 CST 2015

On Sun, Dec 6, 2015 at 3:34 PM, Erica Sadun via swift-evolution <
swift-evolution at swift.org> wrote:

> 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:
> func longZip<S0: SequenceType, S1: SequenceType>(seq0: S0, _ seq1: S1) ->
>     AnyGenerator<(S0.Generator.Element?, S1.Generator.Element?)> {

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.


(j){printf("%d\n",i);}}} /*Dmitri Gribenko <gribozavr at gmail.com>*/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20151206/ce69d57f/attachment.html>

More information about the swift-evolution mailing list