<div dir="ltr">(I forgot to reply-all to mailing list, sorry for double posting Ben!)<div><br><div class="gmail_extra"><br><div class="gmail_quote">On Thu, May 4, 2017 at 8:11 PM, Ben Cohen via swift-evolution <span dir="ltr">&lt;<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div style="word-wrap:break-word"><div><br></div><div><span class="gmail-"><blockquote type="cite"><div>On May 4, 2017, at 10:15 AM, Jaden Geller via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>&gt; wrote:</div><br class="gmail-m_-300610198553892495Apple-interchange-newline"><div><div dir="auto"><div></div><div>It&#39;s been suggested by a core team member that enumerated itself might not hold its weight in the standard library. Instead, we ought to write `zip(foo.indices, foo)` or `zip(0..., foo)`. It&#39;s easier for the caller to see which side of the tuple stores the index and whether the index is an integer or an actual index type. This use case seems to further support this design since `zip(x…, foo)` and `zip(foo.indicies.drop(x), foo)` can be easily written.</div><div><br></div></div></div></blockquote><div><br></div></span><div>Yup, this is my personal preference. Enumerated has a number of correctness and usability issues: slices aren’t zero based so you could miss a potential trap at runtime, order of the two arguments is unclear unlike the zip alternative, and it encourages people to write code using integers rather than indices even one the latter is more expressive and generalizes better if you ever want to make what you wrote generic.</div><div><br></div><div>Note also, since SE-0172 is now implemented on master, you can also write zip(6…, myArray) if you want to alter the starting value.</div></div></div></blockquote><div><br></div><div class="gmail_extra" style="font-size:12.8px"><div class="gmail_quote"><div>I have mentioned this in Alternatives considered section, with following comment:</div><span class="gmail-im"><div><br></div><div>&gt; <span style="color:rgb(36,41,46);font-family:-apple-system,system-ui,&quot;segoe ui&quot;,helvetica,arial,sans-serif,&quot;apple color emoji&quot;,&quot;segoe ui emoji&quot;,&quot;segoe ui symbol&quot;;font-size:14px">Drawback of this approach is that you need to use free function </span><code style="color:rgb(36,41,46);box-sizing:border-box;font-family:sfmono-regular,consolas,&quot;liberation mono&quot;,menlo,courier,monospace;font-size:13.6px;padding:0.2em 0px;margin:0px;background-color:rgba(27,31,35,0.0470588);border-radius:3px">zip</code><span style="color:rgb(36,41,46);font-family:-apple-system,system-ui,&quot;segoe ui&quot;,helvetica,arial,sans-serif,&quot;apple color emoji&quot;,&quot;segoe ui emoji&quot;,&quot;segoe ui symbol&quot;;font-size:14px">, forcing a break in the chain of sequence operations, as there is currently no </span><code style="color:rgb(36,41,46);box-sizing:border-box;font-family:sfmono-regular,consolas,&quot;liberation mono&quot;,menlo,courier,monospace;font-size:13.6px;padding:0.2em 0px;margin:0px;background-color:rgba(27,31,35,0.0470588);border-radius:3px">zipped</code><span style="color:rgb(36,41,46);font-family:-apple-system,system-ui,&quot;segoe ui&quot;,helvetica,arial,sans-serif,&quot;apple color emoji&quot;,&quot;segoe ui emoji&quot;,&quot;segoe ui symbol&quot;;font-size:14px"> method on </span><code style="color:rgb(36,41,46);box-sizing:border-box;font-family:sfmono-regular,consolas,&quot;liberation mono&quot;,menlo,courier,monospace;font-size:13.6px;padding:0.2em 0px;margin:0px;background-color:rgba(27,31,35,0.0470588);border-radius:3px">Sequence</code><span style="color:rgb(36,41,46);font-family:-apple-system,system-ui,&quot;segoe ui&quot;,helvetica,arial,sans-serif,&quot;apple color emoji&quot;,&quot;segoe ui emoji&quot;,&quot;segoe ui symbol&quot;;font-size:14px">.</span></div><div><br></div><p style="color:rgb(36,41,46);font-family:-apple-system,system-ui,&quot;segoe ui&quot;,helvetica,arial,sans-serif,&quot;apple color emoji&quot;,&quot;segoe ui emoji&quot;,&quot;segoe ui symbol&quot;;font-size:14px;box-sizing:border-box;margin-top:0px;margin-bottom:0px">&gt; If this is the preffered approach, we should consider removing the <code style="box-sizing:border-box;font-family:sfmono-regular,consolas,&quot;liberation mono&quot;,menlo,courier,monospace;font-size:13.6px;padding:0.2em 0px;margin:0px;background-color:rgba(27,31,35,0.0470588);border-radius:3px">enumerated()</code> method altogether, because the limited usefullness in its current state hardly justifies the space on API surface it occupies.</p></span></div><br></div><div class="gmail_extra" style="font-size:12.8px">I&#39;d be personally fine with removal of enumerated() if we added zipped(with:). </div><div><span style="font-size:12.8px">Free function zip is essential, no doubt. What was the reason there isn&#39;t also zipped, Ben?</span> </div></div><br></div></div><div class="gmail_extra">--Pavol</div></div>