<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Feb 3, 2017, at 11:12 AM, Erica Sadun via swift-evolution <<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;">I believe what people *want* is `indexed` over `enumerated`, and consistently for both array and array slices.</div><br class="Apple-interchange-newline"></div></blockquote></div><br class=""><div class="">I don’t know if that’s true.</div><div class=""><br class=""></div><div class="">Here’s an example (the only use of enumerated) from Alamofire:</div><div class=""><br class=""></div><div class=""><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #0433ff" class="">let</span><span style="font-variant-ligatures: no-common-ligatures" class=""> acceptLanguage = </span><span style="font-variant-ligatures: no-common-ligatures; color: #3495af" class="">Locale</span><span style="font-variant-ligatures: no-common-ligatures" class="">.</span><span style="font-variant-ligatures: no-common-ligatures; color: #3495af" class="">preferredLanguages</span><span style="font-variant-ligatures: no-common-ligatures" class="">.</span><span style="font-variant-ligatures: no-common-ligatures; color: #3495af" class="">prefix</span><span style="font-variant-ligatures: no-common-ligatures" class="">(6).</span><span style="font-variant-ligatures: no-common-ligatures; color: #3495af" class="">enumerated</span><span style="font-variant-ligatures: no-common-ligatures" class="">().</span><span style="font-variant-ligatures: no-common-ligatures; color: #3495af" class="">map</span><span style="font-variant-ligatures: no-common-ligatures" class=""> { index, languageCode </span><span style="font-variant-ligatures: no-common-ligatures; color: #0433ff" class="">in</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""> </span><span style="font-variant-ligatures: no-common-ligatures; color: #0433ff" class="">let</span><span style="font-variant-ligatures: no-common-ligatures" class=""> quality = 1.0 - (</span><span style="font-variant-ligatures: no-common-ligatures; color: #3495af" class="">Double</span><span style="font-variant-ligatures: no-common-ligatures" class="">(index) * 0.1)</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""> </span><span style="font-variant-ligatures: no-common-ligatures; color: #0433ff" class="">return</span><span style="font-variant-ligatures: no-common-ligatures" class=""> </span><span style="font-variant-ligatures: no-common-ligatures; color: #b4261a" class="">"</span><span style="font-variant-ligatures: no-common-ligatures" class="">\</span><span style="font-variant-ligatures: no-common-ligatures; color: #b4261a" class="">(</span><span style="font-variant-ligatures: no-common-ligatures" class="">languageCode</span><span style="font-variant-ligatures: no-common-ligatures; color: #b4261a" class="">);q=</span><span style="font-variant-ligatures: no-common-ligatures" class="">\</span><span style="font-variant-ligatures: no-common-ligatures; color: #b4261a" class="">(</span><span style="font-variant-ligatures: no-common-ligatures" class="">quality</span><span style="font-variant-ligatures: no-common-ligatures; color: #b4261a" class="">)"</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">}.</span><span style="font-variant-ligatures: no-common-ligatures; color: #3495af" class="">joined</span><span style="font-variant-ligatures: no-common-ligatures" class="">(separator: </span><span style="font-variant-ligatures: no-common-ligatures; color: #b4261a" class="">", "</span><span style="font-variant-ligatures: no-common-ligatures" class="">)</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;" class=""><br class=""><span style="font-variant-ligatures: no-common-ligatures" class=""></span></div></div><div class="">Here the intent is a counter, not indices. They just happen to be the same. But if they’d used <span style="font-family: Menlo; font-size: 11px; font-variant-ligatures: no-common-ligatures; color: rgb(52, 149, 175);" class="">indexed</span><span style="font-family: Menlo; font-size: 11px; font-variant-ligatures: no-common-ligatures;" class="">()</span> it would certainly hurt readability, albeit midly.</div><div class=""><br class=""></div><div class="">Suppose there wasn’t an enumerate or an indexed, and zipped was the standard way of doing it. That might lead to another solution:</div><div class=""><br class=""></div><div class=""><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><div style="margin: 0px; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #0433ff" class="">let</span><span style="font-variant-ligatures: no-common-ligatures" class=""> qualities = </span><span style="font-variant-ligatures: no-common-ligatures; color: #3495af" class="">stride</span><span style="font-variant-ligatures: no-common-ligatures" class="">(from: 1.0, to: 0.4, by: -0.1)</span></div><div style="margin: 0px; line-height: normal; color: rgb(52, 149, 175);" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #0433ff" class="">let</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class=""> acceptLanguage = </span><span style="font-variant-ligatures: no-common-ligatures" class="">Locale</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">.</span><span style="font-variant-ligatures: no-common-ligatures" class="">preferredLanguages</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">.</span><span style="font-variant-ligatures: no-common-ligatures" class="">zipped</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">(with: </span><span style="font-variant-ligatures: no-common-ligatures" class="">qualities</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">).</span><span style="font-variant-ligatures: no-common-ligatures" class="">map</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class=""> {</span></div><div style="margin: 0px; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""> languageCode, quality </span><span style="font-variant-ligatures: no-common-ligatures; color: #0433ff" class="">in</span><span style="font-variant-ligatures: no-common-ligatures" class=""> </span><span style="font-variant-ligatures: no-common-ligatures; color: #b4261a" class="">"</span><span style="font-variant-ligatures: no-common-ligatures" class="">\</span><span style="font-variant-ligatures: no-common-ligatures; color: #b4261a" class="">(</span><span style="font-variant-ligatures: no-common-ligatures" class="">languageCode</span><span style="font-variant-ligatures: no-common-ligatures; color: #b4261a" class="">);q=</span><span style="font-variant-ligatures: no-common-ligatures" class="">\</span><span style="font-variant-ligatures: no-common-ligatures; color: #b4261a" class="">(</span><span style="font-variant-ligatures: no-common-ligatures" class="">quality</span><span style="font-variant-ligatures: no-common-ligatures; color: #b4261a" class="">)"</span></div><div style="margin: 0px; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">}.</span><span style="font-variant-ligatures: no-common-ligatures; color: #3495af" class="">joined</span><span style="font-variant-ligatures: no-common-ligatures" class="">(separator: </span><span style="font-variant-ligatures: no-common-ligatures; color: #b4261a" class="">", "</span><span style="font-variant-ligatures: no-common-ligatures" class="">)</span></div><div style="margin: 0px; line-height: normal; min-height: 13px;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""></span><br class=""></div></div></div><div class="">The use of stride here feels more what was intended, rather than backing into the quality via an “index” value. And avoids any risk with indexed of this getting applied incorrectly to slices.</div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><table class="js-file-line-container highlight tab-size" data-tab-size="8" style="box-sizing: border-box; border-spacing: 0px; border-collapse: collapse; tab-size: 8; color: rgb(51, 51, 51); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; font-size: 14px;"><tbody style="box-sizing: border-box;" class=""><tr style="box-sizing: border-box;" class=""><td id="LC60" class="js-file-line blob-code-inner blob-code" style="box-sizing: border-box; padding: 0px 10px; position: relative; line-height: 20px; vertical-align: top; overflow: visible; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px; word-wrap: normal; white-space: pre;"><br class=""></td></tr></tbody></table></div></body></html>