<div dir="ltr"><div>zip2 (aka "zip") is present in Swift. zip3 is often useful, but not built-in.</div><div><br></div><div>It can be achieved by using multiple copies of zip2:</div><div><br></div><div><font face="monospace, monospace"> for (one, (two, three)) in zip(list1, zip(list2, list3)) ...</font></div><div><br></div><div>It seems like either of these could make sense:</div><div><br></div><div>- Put some reasonable number of implementations, like zip2...zip10, in the standard library, using gyb.</div><div><br></div><div>- Have the compiler generate them on the fly as requested by the user.</div><div><br></div><div>Or, some alternate approaches:</div><div><br></div><div>- Don't do this right now, but count it as motivation for a macro system.</div><div><br></div><div>- Consider making Swift's pattern-matching system extensible, which might allow custom array-based patterns, like "<font face="monospace, monospace">for [one, two, three] in zip(list1, list2, list3)</font>". (I've been thinking of writing a proposal for this anyway.)</div><div><br></div><div><br></div>Does anyone else care about zip3-and-higher? How do these options sound?<div><br clear="all"><div><div class="gmail_signature"><div dir="ltr"><div>Jacob Bandes-Storch<br></div></div></div></div>
</div></div>