<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="">To be honest these all seem equally "weird" looking to me, so my hope is that it's just a matter of familiarity 😊 My personal inclination is still that overloading suffixFrom with a predicate-taking variant is the way to go. That way it occupies the same mental slot as the existing suffixFrom method, and all you have to decide when using it is "do I want to specify where to suffix from, or how to find where to suffix from?". e.g. it basically becomes sugar that turns<div class=""><br class=""></div><div class="">let idx = foo.indexOf { … }</div><div class="">let suffix = foo.suffixFrom(idx)</div><div class=""><br class=""></div><div class="">into</div><div class=""><br class=""></div><div class="">let suffix = foo.suffixFrom { … }</div><div class=""><br class=""></div><div class="">with the bonus feature that it works on single-pass sequences.<br class=""><div class=""><br class=""></div><div class=""><span class="Apple-tab-span" style="white-space:pre">        </span>David<br class=""><div class=""><div class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Jan 13, 2016, at 11:52 PM, Kevin Ballard 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="">
<title class=""></title>
<div class=""><div class="">"suffixAfter" sounds like the equivalent of dropFirst(_:), i.e. it sounds like it should take a count of elements to skip. Similarly, actually trying an expression that takes a predicate looks weird:<br class=""></div>
<div class=""> </div>
<div class=""> seq.suffixAfter({ isspace($0) })<br class=""></div>
<div class=""> </div>
<div class="">Even knowing what it's supposed to do, it's hard for me to read that expression in any sensible fashion.<br class=""></div>
<div class=""> </div>
<div class="">Also, I'm not sure the "noun phrase" convention really makes sense for SequenceType methods. They're not technically mutating methods, but single-pass collections are in fact destructively mutated by Array-returning sequence methods (and the methods that return SubSequence also destructively mutate upon any access to the returned subsequence). Which is to say, despite not being marked as "mutating", they do in fact behave like mutating methods for single-pass sequences. Which suggests that verb phrases are perfectly fine.<br class=""></div>
<div class=""> </div>
<div class="">-Kevin Ballard<br class=""></div>
<div class=""> </div>
<div class="">On Wed, Jan 13, 2016, at 08:36 PM, David Smith via swift-evolution wrote:<br class=""></div>
<blockquote type="cite" class=""><div class=""> </div>
<div class="">Rob Rix pointed out that "suffixAfter" would meet all my original criteria. Not sure if keeping the original "match the stuff to drop rather than the stuff to keep" semantics are critical, but this gives us an option for either way 😊<br class=""></div>
<div class=""> </div>
<div class=""> David<br class=""></div>
<div class=""><div class=""> </div>
<div class="">On Jan 13, 2016, at 6:40 PM, David Smith via swift-evolution <<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>> wrote:<br class=""></div>
</div>
<blockquote type="cite" class=""><div class=""><div class="">Naming conventions would suggest that something returning a new collection should be named with a noun phrase describing what it returns. Unfortunately, most of the ones I can think of off the top of my head are fairly clunky. "suffixFromFirstNonMatchingElement" describes what it does, but I haven't thought of a non-painful way to say that yet. "suffixExcluding" is almost right, but it incorrectly implies (to my eye at least) that the returned collection excludes all elements matching the predicate, rather than just matching prefixes. Hm, what about flipping the predicate and getting a "suffixFrom" overload that takes a predicate for the first matching element to be included, rather than the last matching element to be excluded?<br class=""></div>
<div class=""> </div>
<div class=""><span style="white-space:pre;" class=""></span>David<br class=""></div>
<div class=""><div class=""> </div>
<div class=""><blockquote type="cite" class=""><div class="">On Jan 13, 2016, at 5:54 PM, Dany St-Amant via swift-evolution <<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>> wrote:<br class=""></div>
<div class=""> </div>
<div class=""><div style="word-wrap:break-word;-webkit-line-break:after-white-space;" class=""><div class="">The dropWhile sounds weird to me, I usually would see such functionality as a dropUntil; I discard stuff until I see what I want.<br class=""></div>
<div class="">Your example below doesn’t use dropWhile, but skipWhile; which sounds a bit better that dropWhile as one skip what he doesn’t want.<br class=""></div>
<div class=""> </div>
<div class="">What do the other languages use? A dropWhile, skipWhile or dropUntil concept?<br class=""></div>
<div class=""> </div>
<div class="">Dany<br class=""></div>
<div class=""> </div>
<div class=""> </div>
<div class=""><blockquote type="cite" class=""><div class="">Le 11 janv. 2016 à 01:20, Kevin Ballard via swift-evolution <<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>> a écrit :<br class=""></div>
<div class=""><div style="word-wrap:break-word;-webkit-line-break:after-white-space;" class=""><div class=""> </div>
<div class="">Here's a few toy examples, if it helps:<br class=""></div>
<div class=""> </div>
<div class=""><div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0, 132, 0);" class="">// list of all powers of 2 below some limit<br class=""></div>
<div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;font-size:11px;line-height:normal;font-family:Menlo;" class="">iterate(<span class="colour" style="color:rgb(39, 42, 216)">1</span>, apply: { $0 * <span class="colour" style="color:rgb(39, 42, 216)">2</span> }).takeWhile({ $0 < limit })<br class=""></div>
<div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;font-size:11px;line-height:normal;font-family:Menlo;min-height:13px;" class=""> </div>
<div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0, 132, 0);" class="">// first "word" of a string, skipping whitespace<br class=""></div>
<div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;font-size:11px;line-height:normal;font-family:Menlo;" class=""><span class="colour" style="color:rgb(187, 44, 162)">let</span> cs = NSCharacterSet.whitespaceCharacterSet()<br class=""></div>
<div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;font-size:11px;line-height:normal;font-family:Menlo;" class="">String(str.unicodeScalars.skipWhile({ cs.longCharacterIsMember($0.value) })<br class=""></div>
<div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;font-size:11px;line-height:normal;font-family:Menlo;" class=""> .takeWhile({ !cs.longCharacterIsMember($0.value) }))<br class=""></div>
<div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;font-size:11px;line-height:normal;font-family:Menlo;min-height:13px;" class=""> </div>
<div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0, 132, 0);" class="">// running total of an array of numbers<br class=""></div>
<div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;font-size:11px;line-height:normal;font-family:Menlo;" class="">numbers.scan(<span class="colour" style="color:rgb(39, 42, 216)">0</span>, combine: +).dropFirst()<br class=""></div>
<div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;font-size:11px;line-height:normal;font-family:Menlo;min-height:13px;" class=""> </div>
<div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0, 132, 0);" class="">// infinite fibonacci sequence<br class=""></div>
<div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;font-size:11px;line-height:normal;font-family:Menlo;" class="">iterate((<span class="colour" style="color:rgb(39, 42, 216)">0</span>,<span class="colour" style="color:rgb(39, 42, 216)">1</span>), apply: { ($1, $0+$1) }).lazy.map({$1})<br class=""></div>
</div>
<div class=""> </div>
<div class="">-Kevin Ballard<br class=""></div>
<div class=""> </div>
<blockquote type="cite" class=""><div class=""><blockquote style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0.8ex;border-left-width:1px;border-left-color:rgb(204, 204, 204);border-left-style:solid;padding-left:1ex;" class=""><div class=""><blockquote style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0.8ex;border-left-width:1px;border-left-color:rgb(204, 204, 204);border-left-style:solid;padding-left:1ex;" class=""><div class="">On Mon, Dec 28, 2015, at 03:59 PM, Kevin Ballard wrote:<br class=""></div>
<div class="">><br class=""></div>
<div class="">> ## Detailed design<br class=""></div>
<div class="">><br class=""></div>
<div class="">> We add the following extension to SequenceType:<br class=""></div>
<div class="">><br class=""></div>
<div class="">> extension SequenceType {<br class=""></div>
<div class="">> func scan<T>(initial: T, @noescape combine: (T, Self.Generator.Element) throws -> T) rethrows -> [T]<br class=""></div>
<div class="">> func dropWhile(@noescape dropElement: (Self.Generator.Element) throws -> Bool) rethrows -> [Self.Generator.Element]<br class=""></div>
<div class="">> func takeWhile(@noescape takeElement: (Self.Generator.Element) throws -> Bool) rethrows -> [Self.Generator.Element]<br class=""></div>
<div class="">> }<br class=""></div>
<div class="">><br class=""></div>
</blockquote></div>
</blockquote></div>
</blockquote></div>
</div>
</blockquote></div>
<div class=""> </div>
<div class=""> <img style="height:1px !important;width:1px !important;border-top-width:0px !important;border-right-width:0px !important;border-bottom-width:0px !important;border-left-width:0px !important;margin-top:0px !important;margin-bottom:0px !important;margin-right:0px !important;margin-left:0px !important;padding-top:0px !important;padding-bottom:0px !important;padding-right:0px !important;padding-left:0px !important;" border="0" height="1" width="1" alt="" src="https://www.fastmailusercontent.com/proxy/b56f62c953dd35e47af9e35e7e65cf5da4571de9045c2d6d82524566e169b0bf/8647470737a3f2f25723030323431303e23647e23756e64676279646e2e65647f27766f2f60756e6f35707e6d316546573364777448753a4d426f45394450325d22364d2236496d22364943643d6258357e41384d223642505143763c45664368373e6931364569745f43383252653038623a78446d6a6754457a4951787c6b4a4b4739794f4b6e4570324d22324676646f47507736425b4d2232464953567a51686d2236453979796f65364d2236417f474d2236435b674333553256514361536544374a6c4d6136375c64396b625b47324c653a584f626178734342374644367b6d223244715d63593d485d41353350393f64517830753b434075313b47533762596a4864526b4334533e686a6f6b6545734054664433345277654a4b683f42316537397d4332363b44794d23344/open" class=""><br class=""></div>
</div>
<div class="">_______________________________________________<br class=""></div>
<div class="">swift-evolution mailing list<br class=""></div>
<div class=""><a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a><br class=""></div>
<div class=""><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" class="">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br class=""></div>
</div>
</blockquote></div>
</div>
<div class=""><img style="height:1px !important;width:1px !important;border-top-width:0px !important;border-right-width:0px !important;border-bottom-width:0px !important;border-left-width:0px !important;margin-top:0px !important;margin-bottom:0px !important;margin-right:0px !important;margin-left:0px !important;padding-top:0px !important;padding-bottom:0px !important;padding-right:0px !important;padding-left:0px !important;" border="0" height="1" width="1" alt="" src="https://www.fastmailusercontent.com/proxy/eefeab9f47621fc0b43c8cdd386775462df532f089815082ba12e8f2b7adea88/8647470737a3f2f25723030323431303e23647e23756e64676279646e2e65647f27766f2f60756e6f35707e6d316546573364777448753a4d426f45394450325d22364d2236496d22364943643d6258357e41384d223642505143763c456644603a705864577376316969385b6f634848353742455d6244375a54436762336956736274366a77717d223641447146346d4d64456577623766494d4a58464e65745e476e6f6167585c607252427b62643173456441524a7b41546a6c4967683669334b6263466a5734395a467d223244305149645055685152535b497348754d223243587f453d22364d4d2236437637354970726630383859424a5c6a48377652487436567a555537574d495360526f637472553868303842774566777533547f675949797b6260575b6d23344/open" class=""><br class=""></div>
</div>
</blockquote><blockquote type="cite" class=""><div class=""><div class=""><span class="">_______________________________________________</span><br class=""></div>
<div class=""><span class="">swift-evolution mailing list</span><br class=""></div>
<div class=""><span class=""><a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a></span><br class=""></div>
<div class=""><span class=""><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" class="">https://lists.swift.org/mailman/listinfo/swift-evolution</a></span><br class=""></div>
</div>
</blockquote><div class=""><img style="height:1px !important;width:1px !important;border-top-width:0px !important;border-right-width:0px !important;border-bottom-width:0px !important;border-left-width:0px !important;margin-top:0px !important;margin-bottom:0px !important;margin-right:0px !important;margin-left:0px !important;padding-top:0px !important;padding-bottom:0px !important;padding-right:0px !important;padding-left:0px !important;" border="0" height="1" width="1" alt="" src="https://www.fastmailusercontent.com/proxy/24301e8416e759fb8f0fab5459bef80dc19fa9fb7657df4a14f4b7a0f2f17783/8647470737a3f2f25723030323431303e23647e23756e64676279646e2e65647f27766f2f60756e6f35707e6d3148765176786c673171614a7d2236454230345272776e44675f66733d22324d634967724848326e41554c4074695a50335473444943536d223244575b44536857644a6a7a64434a59305b494d22364238545b666734474c425265544645763454476033454540705b44343d415772707d22324d42555070386d22364570383b44593871685332796751523952665f4632623a6545697d223647754639614f43753e4163463d2236493377517f4e6166585b6a7173324c4f485161486b46763d22364f673c62755b4671523474755070565051346b6b675c433078513156705470735d6d437144477d23344d23344/open" class=""><br class=""></div>
<div class=""><u class="">_______________________________________________</u><br class=""></div>
<div class="">swift-evolution mailing list<br class=""></div>
<div class=""><a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a><br class=""></div>
<div class=""><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" class="">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br class=""></div>
</blockquote><div class=""> </div>
<img src="https://u2002410.ct.sendgrid.net/wf/open?upn=aEV7ctwDx5JMbO5IT0R-2F-2Fi-2FIc4mR8uN1H-2FRPAs6LeFfQ9seDYInxcGpw2wB3-2Bptt6QAi5PNyn3vbjJFvJ-2BsxKDC-2BngrfOpJc3f2xUXzgVSpERXEqZvtvg1WUEwQ6rA81Z1LjXwN8y4iLWCtMYJZsbJUQyIDSxZWbq03WmiPo-2F2Pw6AoGzlmNb1vyMYIHLSnGtzdDRzJyL1EICyAGncIH2TDCCu0-2BuLLGBOxuM9xF-2BAA-3D" alt="" width="1" height="1" border="0" style="height:1px !important;width:1px !important;border-width:0 !important;margin-top:0 !important;margin-bottom:0 !important;margin-right:0 !important;margin-left:0 !important;padding-top:0 !important;padding-bottom:0 !important;padding-right:0 !important;padding-left:0 !important;" class="">
</div>
_______________________________________________<br class="">swift-evolution mailing list<br class=""><a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a><br class="">https://lists.swift.org/mailman/listinfo/swift-evolution<br class=""></div></blockquote></div><br class=""></div></div></div></div></body></html>