<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><div></div><div>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 😊</div><div><br></div><div> David</div><div><br>On Jan 13, 2016, at 6:40 PM, David Smith via swift-evolution <<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a>> wrote:<br><br></div><blockquote type="cite"><div><meta http-equiv="Content-Type" content="text/html charset=utf-8">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?<div class=""><br class=""></div><div class=""><span class="Apple-tab-span" style="white-space:pre">        </span>David</div><div class=""><br class=""><div><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:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html charset=utf-8" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -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.</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.</div><div class=""><br class=""></div><div class="">What do the other languages use? A dropWhile, skipWhile or dropUntil concept?</div><div class=""><br class=""></div><div class="">Dany</div><div class=""><br class=""></div><br class=""><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 :</div><div class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class=""><br class=""></div>
<div class="">Here's a few toy examples, if it helps:<br class=""></div>
<div class=""><br class=""></div><div class=""><div style="margin: 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</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">iterate(<span style="font-variant-ligatures: no-common-ligatures; color: #272ad8" class="">1</span>, apply: { $0 * <span style="font-variant-ligatures: no-common-ligatures; color: #272ad8" class="">2</span> }).takeWhile({ $0 < limit })</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;" class=""><br class=""></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(0, 132, 0);" class="">// first "word" of a string, skipping whitespace</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">let</span> cs = NSCharacterSet.whitespaceCharacterSet()</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">String(str.unicodeScalars.skipWhile({ cs.longCharacterIsMember($0.value) })</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""> .takeWhile({ !cs.longCharacterIsMember($0.value) }))</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;" class=""><br class=""></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(0, 132, 0);" class="">// running total of an array of numbers</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">numbers.scan(<span style="font-variant-ligatures: no-common-ligatures; color: #272ad8" class="">0</span>, combine: +).dropFirst()</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;" class=""><br class=""></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(0, 132, 0);" class="">// infinite fibonacci sequence</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">iterate((<span style="font-variant-ligatures: no-common-ligatures; color: #272ad8" class="">0</span>,<span style="font-variant-ligatures: no-common-ligatures; color: #272ad8" class="">1</span>), apply: { ($1, $0+$1) }).lazy.map({$1})</div></div>
<div class=""><br class=""></div>
<div class="">-Kevin Ballard</div>
<div class=""><br 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="">></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><br class="">
<img src="https://u2002410.ct.sendgrid.net/wf/open?upn=aEV7ctwDx5JMbO5IT0R-2F-2Fi-2FIc4mR8uN1H-2FRPAs6LeFc87n91FeyTO38Rb50h2zHdmjWDuJYqxlKJK7yIOkNu0B-2BvfdOWp7FRK-2BFYSvZah-2F5yyio5F-2FqOG-2FSkG3S5RVAcQcE4GjLm16Wl4ikRK7Bl5ZHobqxCC2GF4vk-2BtQmS9MXM15S09oTq8p5KCp51KW3gRiJhTbK3T3nhjokEuCPdF43TrgEJk8O2a57yM326KtI-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=""><a href="https://lists.swift.org/mailman/listinfo/swift-evolution">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br class=""></div></blockquote></div><br class=""></div>
<img src="https://u2002410.ct.sendgrid.net/wf/open?upn=aEV7ctwDx5JMbO5IT0R-2F-2Fi-2FIc4mR8uN1H-2FRPAs6LeFd0zPhTws6ai9XkoCH85GBUmB4WZDcg2cYvcr4fzwq-2FAtA6dMmDeug2gFIMZHFnuTNgnoaWXlpRBrkb4qCeDQBzKQdjLig8f9CkbCfZ74YJv-2B4PAiTPeXQRSKyCxE-2BSxO5-2FM-2Fs67Eypb608XIBZlJ8wVBx4VvZU5WGMYcPbostR5h80HrGevw5StoWIyykbPWk-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;">
</div></blockquote><blockquote type="cite"><div><span>_______________________________________________</span><br><span>swift-evolution mailing list</span><br><span><a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a></span><br><span><a href="https://lists.swift.org/mailman/listinfo/swift-evolution">https://lists.swift.org/mailman/listinfo/swift-evolution</a></span><br></div></blockquote></body></html>