<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=""><div class="">I agree we shouldn’t have both, that would cause confusion/bloat. The downside I see of making zip a method on Sequence is that the first argument is not somehow more “special” than the second. Were it not for the chaining (and discoverability) issue, I’d be against it – it feels right as a free function. By the same rationale, would max be a method on Comparable? </div><div class=""><br class=""></div><div class="">The bouncing-right-to-left issue is a more general problem, and is also a problem with feeding results into initializers. An alternative is that someday we could add the pipe-forward operator:</div><div class=""><br class=""></div><div class="">(note this is not a pitch, just a someday-idea :-)</div><div class=""><br class=""></div><div class=""><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(0, 143, 0);" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">// precedence would need some thought</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures; color: rgb(4, 51, 255);" class="">infix</span><span style="font-variant-ligatures: no-common-ligatures;" class=""> </span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(4, 51, 255);" class="">operator</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=""><span style="font-variant-ligatures: no-common-ligatures;" class=""></span><br class=""></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures; color: rgb(4, 51, 255);" class="">func</span><span style="font-variant-ligatures: no-common-ligatures;" class=""> |> <T,U>(lhs: </span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(52, 149, 175);" class="">T</span><span style="font-variant-ligatures: no-common-ligatures;" class="">, rhs: (</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(52, 149, 175);" class="">T</span><span style="font-variant-ligatures: no-common-ligatures;" class="">)-></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(52, 149, 175);" class="">U</span><span style="font-variant-ligatures: no-common-ligatures;" class="">) -> </span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(52, 149, 175);" class="">U</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;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""> </span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(4, 51, 255);" class="">return</span><span style="font-variant-ligatures: no-common-ligatures;" class=""> rhs(lhs)</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></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""></span><br class=""></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(180, 38, 26);" class=""><span style="font-variant-ligatures: no-common-ligatures; color: rgb(4, 51, 255);" class="">let</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(0, 0, 0);" class=""> words = [</span><span style="font-variant-ligatures: no-common-ligatures;" class="">"five"</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(0, 0, 0);" class="">,</span><span style="font-variant-ligatures: no-common-ligatures;" class="">"four"</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(0, 0, 0);" class="">,</span><span style="font-variant-ligatures: no-common-ligatures;" class="">"three"</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(0, 0, 0);" class="">,</span><span style="font-variant-ligatures: no-common-ligatures;" class="">"two"</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(0, 0, 0);" class="">,</span><span style="font-variant-ligatures: no-common-ligatures;" class="">"one"</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(0, 0, 0);" class="">,</span><span style="font-variant-ligatures: no-common-ligatures;" class="">"blastoff!"</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(0, 0, 0);" 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="">((0...5)</span><span style="font-variant-ligatures: no-common-ligatures;" class="">.</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(52, 149, 175);" class="">reversed</span><span style="font-variant-ligatures: no-common-ligatures;" class="">() </span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(52, 149, 175);" class="">|></span><span style="font-variant-ligatures: no-common-ligatures;" class=""> { </span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(52, 149, 175);" class="">zip</span><span style="font-variant-ligatures: no-common-ligatures;" class="">($0, </span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(52, 149, 175);" class="">words</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;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""> .</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(52, 149, 175);" class="">forEach</span><span style="font-variant-ligatures: no-common-ligatures;" class=""> { </span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(52, 149, 175);" class="">print</span><span style="font-variant-ligatures: no-common-ligatures;" class="">($0.0,$0.1, separator: </span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(180, 38, 26);" 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="">Still pretty ugly though. Some language sugar (again not a pitch) might help:</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;" class="">((0...5).<span style="color: rgb(52, 149, 175);" class="">reversed</span>() |> <span style="color: rgb(52, 149, 175);" class="">zip</span>(</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(4, 51, 255);" class="">_</span><span style="font-variant-ligatures: no-common-ligatures;" class="">, <span style="color: rgb(52, 149, 175);" class="">words</span>))</span></div><div style="margin: 0px; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""> .<span style="color: rgb(52, 149, 175);" class="">forEach</span> { <span style="color: rgb(52, 149, 175);" class="">print</span>($0.0,$0.1, separator: </span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(180, 38, 26);" class="">": "</span><span style="font-variant-ligatures: no-common-ligatures;" class="">) }</span></div><div class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""><br class=""></span></div></div></div><div class="">Then again, I don’t know if facilitating chaining like this is really that important. I usually find assigning to an intermediate variable to be just as readable when the chaining doesn’t quite flow right.</div><div class=""><br class=""></div><div><blockquote type="cite" class=""><div class="">On May 7, 2017, at 11:01 AM, Xiaodi Wu <<a href="mailto:xiaodi.wu@gmail.com" class="">xiaodi.wu@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class="">I don't see where anything is broken. It sounds like you simply prefer one style over another, which is fine but cannot justify two features in the standard library that do the same thing. As you demonstrate, you can easily write your own method if that's your preference.<br class=""><div class="gmail_quote"><div dir="ltr" class="">On Sun, May 7, 2017 at 04:18 Pavol Vaskovic <<a href="mailto:pali@pali.sk" class="">pali@pali.sk</a>> wrote:<br class=""></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word" class=""><br class=""><div class=""><blockquote type="cite" class=""><div class="">On 7 May 2017, at 10:30, Xiaodi Wu <<a href="mailto:xiaodi.wu@gmail.com" target="_blank" class="">xiaodi.wu@gmail.com</a>> wrote:</div><div class=""><div dir="ltr" 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" class=""><div class="gmail_extra"><div class="gmail_quote"><br class=""><div class="">Sorry, I'm confused: what is the point of adding a method that does the same thing as an existing free function? With one-sided ranges now a part of the language, I'd support removal of `enumerated()` with no other changes.</div></div></div></div></div></blockquote></div><br class=""></div><div style="word-wrap:break-word" class=""><div class="">I’m talking about scenario where you have a chain of sequence operations, say:</div><div class=""><br class=""></div><div class=""><div style="margin:0px;line-height:normal;font-family:'DejaVu Sans Mono';color:rgb(50,137,213)" class=""><div style="margin:0px;line-height:normal;color:rgb(100,122,131)" class=""><span style="font-variant-ligatures:no-common-ligatures" class="">(</span><span style="font-variant-ligatures:no-common-ligatures;color:#d73f82" class="">1</span><span style="font-variant-ligatures:no-common-ligatures" class="">...N).</span><span style="font-variant-ligatures:no-common-ligatures;color:#3289d5" class="">makeIterator</span><span style="font-variant-ligatures:no-common-ligatures" class="">().</span><span style="font-variant-ligatures:no-common-ligatures;color:#3289d5" class="">enumerated</span><span style="font-variant-ligatures:no-common-ligatures" class="">().</span><span style="font-variant-ligatures:no-common-ligatures;color:#3289d5" class="">lazy</span><span style="font-variant-ligatures:no-common-ligatures" class="">.</span><span style="font-variant-ligatures:no-common-ligatures;color:#3289d5" class="">prefix</span><span style="font-variant-ligatures:no-common-ligatures" class="">(while: {$0.</span><span style="font-variant-ligatures:no-common-ligatures;color:#d73f82" class="">0</span><span style="font-variant-ligatures:no-common-ligatures" class=""> < oneLess}).</span><span style="font-variant-ligatures:no-common-ligatures;color:#3289d5" class="">count</span><span style="font-variant-ligatures:no-common-ligatures" class="">()</span></div></div></div><div style="margin:0px;line-height:normal;font-family:'DejaVu Sans Mono';color:rgb(50,137,213)" class=""><span style="font-variant-ligatures:no-common-ligatures;color:#647a83" class=""><br class=""></span></div><div style="margin:0px;line-height:normal;font-family:'DejaVu Sans Mono';color:rgb(50,137,213)" class=""><span style="font-family: Helvetica;" class="">With a free function, you need to break the chain in order to replace enumerated with zip:</span></div><div style="margin:0px;line-height:normal;font-family:'DejaVu Sans Mono';color:rgb(50,137,213)" class=""><span style="font-family: Helvetica;" class=""><br class=""></span></div><div style="margin:0px;line-height:normal;font-family:'DejaVu Sans Mono';color:rgb(50,137,213)" class=""><div style="margin:0px;line-height:normal;color:rgb(100,122,131)" class=""><div style="margin:0px;line-height:normal" class=""><div style="margin:0px;line-height:normal" class=""><span style="font-variant-ligatures:no-common-ligatures;color:#3289d5" class="">zip</span><span style="font-variant-ligatures:no-common-ligatures" class="">((</span><span style="font-variant-ligatures:no-common-ligatures;color:#d73f82" class="">1</span><span style="font-variant-ligatures:no-common-ligatures" class="">...N).</span><span style="font-variant-ligatures:no-common-ligatures;color:#3289d5" class="">makeIterator</span><span style="font-variant-ligatures:no-common-ligatures" class="">(), </span><span style="font-variant-ligatures:no-common-ligatures;color:#d73f82" class="">0</span><span style="font-variant-ligatures:no-common-ligatures" class="">...oneLess).</span><span style="font-variant-ligatures:no-common-ligatures;color:#3289d5" class="">lazy</span><span style="font-variant-ligatures:no-common-ligatures" class="">.</span><span style="font-variant-ligatures:no-common-ligatures;color:#3289d5" class="">prefix</span><span style="font-variant-ligatures:no-common-ligatures" class="">(while: {$0.</span><span style="font-variant-ligatures:no-common-ligatures;color:#d73f82" class="">0</span><span style="font-variant-ligatures:no-common-ligatures" class=""> < oneLess}).</span><span style="font-variant-ligatures:no-common-ligatures;color:#3289d5" class="">count</span><span style="font-variant-ligatures:no-common-ligatures" class="">()</span></div></div></div></div><div style="margin:0px;line-height:normal;font-family:'DejaVu Sans Mono';color:rgb(50,137,213)" class=""><span style="font-family: Helvetica;" class=""><br class=""></span></div><div style="margin:0px;line-height:normal;font-family:'DejaVu Sans Mono';color:rgb(50,137,213)" class=""><span style="font-family: Helvetica;" class="">It forces you to rearrange your code into less than ideal order. Free function zip works great if you start with it. Not when you need to employ it in the middle of the chain. </span></div><div style="margin:0px;line-height:normal;font-family:'DejaVu Sans Mono';color:rgb(50,137,213)" class=""><span style="font-family: Helvetica;" class=""><br class=""></span></div><div style="margin:0px;line-height:normal;font-family:'DejaVu Sans Mono';color:rgb(50,137,213)" class=""><div style="margin:0px;line-height:normal;color:rgb(100,122,131)" class=""><span style="font-variant-ligatures:no-common-ligatures" class="">(</span><span style="font-variant-ligatures:no-common-ligatures;color:#d73f82" class="">1</span><span style="font-variant-ligatures:no-common-ligatures" class="">...N).</span><span style="font-variant-ligatures:no-common-ligatures;color:#3289d5" class="">makeIterator</span><span style="font-variant-ligatures:no-common-ligatures" class="">().</span><span style="font-variant-ligatures:no-common-ligatures;color:#3289d5" class="">zipped</span><span style="font-variant-ligatures:no-common-ligatures" class="">(with: </span><span style="font-variant-ligatures:no-common-ligatures;color:#d73f82" class="">0</span><span style="font-variant-ligatures:no-common-ligatures" class="">...oneLess).</span><span style="font-variant-ligatures:no-common-ligatures;color:#3289d5" class="">lazy</span><span style="font-variant-ligatures:no-common-ligatures" class="">.</span><span style="font-variant-ligatures:no-common-ligatures;color:#3289d5" class="">prefix</span><span style="font-variant-ligatures:no-common-ligatures" class="">(while: {$0.</span><span style="font-variant-ligatures:no-common-ligatures;color:#d73f82" class="">0</span><span style="font-variant-ligatures:no-common-ligatures" class=""> < oneLess}).</span><span style="font-variant-ligatures:no-common-ligatures;color:#3289d5" class="">count</span><span style="font-variant-ligatures:no-common-ligatures" class="">()</span></div></div><div style="margin:0px;line-height:normal;font-family:'DejaVu Sans Mono';color:rgb(50,137,213)" class=""><span style="font-family: Helvetica;" class=""><br class=""></span></div><div style="margin:0px;line-height:normal" class="">Just to be clear, how much change I’m proposing here, in case we remove enumerated:</div><div style="margin:0px;line-height:normal" class=""><br class=""></div><div style="margin:0px;line-height:normal" class=""><div style="margin:0px;line-height:normal;font-family:'DejaVu Sans Mono';color:rgb(215,63,130)" class=""><span style="font-variant-ligatures:no-common-ligatures" class="">extension</span><span style="font-variant-ligatures:no-common-ligatures;color:#647a83" class=""> </span><span style="font-variant-ligatures:no-common-ligatures;color:#ce4d28" class="">Sequence</span><span style="font-variant-ligatures:no-common-ligatures;color:#647a83" class=""> {</span></div><div style="margin:0px;line-height:normal;font-family:'DejaVu Sans Mono';color:rgb(100,122,131)" class=""><span style="font-variant-ligatures:no-common-ligatures" class=""> </span><span style="font-variant-ligatures:no-common-ligatures;color:#d73f82" class="">func</span><span style="font-variant-ligatures:no-common-ligatures" class=""> zipped<S>(with otherSequence: </span><span style="font-variant-ligatures:no-common-ligatures;color:#ce4d28" class="">S</span><span style="font-variant-ligatures:no-common-ligatures" class="">) -> </span><span style="font-variant-ligatures:no-common-ligatures;color:#ce4d28" class="">Zip2Sequence</span><span style="font-variant-ligatures:no-common-ligatures" class=""><</span><span style="font-variant-ligatures:no-common-ligatures;color:#ce4d28" class="">Self</span><span style="font-variant-ligatures:no-common-ligatures" class="">, </span><span style="font-variant-ligatures:no-common-ligatures;color:#ce4d28" class="">S</span><span style="font-variant-ligatures:no-common-ligatures" class="">> </span><span style="font-variant-ligatures:no-common-ligatures;color:#d73f82" class="">where</span><span style="font-variant-ligatures:no-common-ligatures" class=""> </span><span style="font-variant-ligatures:no-common-ligatures;color:#ce4d28" class="">S</span><span style="font-variant-ligatures:no-common-ligatures" class="">: </span><span style="font-variant-ligatures:no-common-ligatures;color:#ce4d28" class="">Sequence</span><span style="font-variant-ligatures:no-common-ligatures" class=""> {</span></div><div style="margin:0px;line-height:normal;font-family:'DejaVu Sans Mono';color:rgb(100,122,131)" class=""><span style="font-variant-ligatures:no-common-ligatures" class=""> </span><span style="font-variant-ligatures:no-common-ligatures;color:#d73f82" class="">return</span><span style="font-variant-ligatures:no-common-ligatures" class=""> </span><span style="font-variant-ligatures:no-common-ligatures;color:#3289d5" class="">zip</span><span style="font-variant-ligatures:no-common-ligatures" class=""> (</span><span style="font-variant-ligatures:no-common-ligatures;color:#d73f82" class="">self</span><span style="font-variant-ligatures:no-common-ligatures" class="">, otherSequence)</span></div><div style="margin:0px;line-height:normal;font-family:'DejaVu Sans Mono';color:rgb(100,122,131)" class=""><span style="font-variant-ligatures:no-common-ligatures" class=""> }</span></div><div style="margin:0px;line-height:normal;font-family:'DejaVu Sans Mono';color:rgb(100,122,131)" class=""><span style="font-variant-ligatures:no-common-ligatures" class="">}</span></div></div><div style="margin:0px;line-height:normal" class=""><br class=""></div><div style="margin:0px;line-height:normal" class=""><div style="margin:0px;line-height:normal" class="">Best regards</div><div style="margin:0px;line-height:normal" class="">Pavol Vaskovic </div></div></div></blockquote></div>
</div></blockquote></div><br class=""></body></html>