[swift-evolution] zip3, zip4, ...
jtbandes at gmail.com
Sun Dec 6 17:01:18 CST 2015
zip2 (aka "zip") is present in Swift. zip3 is often useful, but not
It can be achieved by using multiple copies of zip2:
for (one, (two, three)) in zip(list1, zip(list2, list3)) ...
It seems like either of these could make sense:
- Put some reasonable number of implementations, like zip2...zip10, in the
standard library, using gyb.
- Have the compiler generate them on the fly as requested by the user.
Or, some alternate approaches:
- Don't do this right now, but count it as motivation for a macro system.
- Consider making Swift's pattern-matching system extensible, which might
allow custom array-based patterns, like "for [one, two, three] in
zip(list1, list2, list3)". (I've been thinking of writing a proposal for
Does anyone else care about zip3-and-higher? How do these options sound?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the swift-evolution