<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">Yes. If we’re fussing over the verb tense, “compacted” is clearly correct. Where did “compacting” come from? The API guidelines state:<div class=""><br class=""></div><div class=""><blockquote type="cite" class="">Prefer to name the nonmutating variant using the verb’s past participle (usually appending “ed”).</blockquote></div><div class=""><br class=""></div><div class="">…and (emphasis added):</div><div class=""><br class=""></div><div class=""><blockquote type="cite" class="">When adding “ed” _<b class="">is not grammatical because the verb has a direct object_</b>, name the nonmutating variant using the verb’s present participle, by appending “ing.” <br class=""></blockquote><div class=""><br class=""></div><div class="">Thus “joined” and “sorted” — also no-args methods where the verb has no direct object.</div><div class=""><br class=""></div><div class="">BUT</div><div class=""><br class=""></div><div class="">The existing methods “filter” and “reduce” seem the nearest peers to the proposed “compact,” and we do not call them “filtered” and “reduced.” Those are the methods with which the new one should maintain consistency.</div><div class=""><br class=""></div><div class="">P</div><br class=""><div><br class=""><blockquote type="cite" class=""><div class="">On Dec 19, 2017, at 5:52 PM, Nevin Brackett-Rozinsky 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 dir="ltr" class="">If we’re bikeshedding the verb tense then “compactMap” sounds right to me, and adding “ing” would be needlessly verbose.<div class=""><br class=""></div><div class="">For the non-mapping version, I’d lean toward “compacted”. However, we could also postpone the debate over its spelling until such time as we are actually ready to introduce it.</div><div class=""><br class=""></div><div class="">Nevin</div><div class=""><br class=""></div><div class=""><br class=""></div></div><div class="gmail_extra"><br class=""><div class="gmail_quote">On Tue, Dec 19, 2017 at 6:42 PM, Dave Abrahams via swift-evolution <span dir="ltr" class=""><<a href="mailto:swift-evolution@swift.org" target="_blank" class="">swift-evolution@swift.org</a>></span> wrote:<br class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word;line-break:after-white-space" class=""><span class=""><br class=""><div class=""><br class=""><blockquote type="cite" class=""><div class="">On Dec 19, 2017, at 2:28 PM, Xiaodi Wu via swift-evolution <<a href="mailto:swift-evolution@swift.org" target="_blank" class="">swift-evolution@swift.org</a>> wrote:</div><br class="m_-1493299564316744864Apple-interchange-newline"><div class="">I disagree. Let’s not reopen what is settled. “Compact” can be a noun just as “map” and “filter” can; as long as there are no in-place variants, there can be no ambiguity.<br class=""><div class="gmail_quote"><div dir="ltr" class="">On Tue, Dec 19, 2017 at 17:11 Brent Royal-Gordon via swift-evolution <<a href="mailto:swift-evolution@swift.org" target="_blank" class="">swift-evolution@swift.org</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;line-break:after-white-space" class=""><div class=""><blockquote type="cite" class=""><div class="">On Dec 19, 2017, at 8:56 AM, John McCall <<a href="mailto:rjmccall@apple.com" target="_blank" class="">rjmccall@apple.com</a>> wrote:</div><br class="m_-1493299564316744864m_4244156192150185115Apple-interchange-newline"><div class=""><span 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;float:none;display:inline!important" class="">Therefore, SE-0187 is<span class="m_-1493299564316744864m_4244156192150185115Apple-converted-space"> </span></span><b style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" class="">accepted</b><span 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;float:none;display:inline!important" class="">, with the<span class="m_-1493299564316744864m_4244156192150185115Apple-converted-space"> </span></span><b style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" class="">revision</b><span 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;float:none;display:inline!important" class=""><span class="m_-1493299564316744864m_4244156192150185115Apple-converted-space"> </span>that the new name be Sequence.compactMap(_:), and with the agreement that we will add Sequence.compact() when it is possible to do so.</span><br 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></blockquote></div><div class=""><br class=""></div></div><div style="word-wrap:break-word;line-break:after-white-space" class=""><div class="">I like `compact` as the basis for the name, but I hope the core team will consider whether the eventual nil-removal method should be called `compacting()`, and whether therefore this method should be called `compactingMap(_:)`. Prior art on the name `compact()` does exist, but I don't think it's strong enough to justify deviating from the API Guidelines.</div><div class=""><br class=""></div><div class="">I don't think we need a full review on this tiny issue; five minutes of the core team's time should more than suffice.</div></div></blockquote></div></div></blockquote></div><br class=""></span><div class="">I agree with Brent. IMO we're firmly outside the domain of established terms-of-art here (Ruby notwithstanding). </div></div><br class="">______________________________<wbr class="">_________________<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" rel="noreferrer" target="_blank" class="">https://lists.swift.org/<wbr class="">mailman/listinfo/swift-<wbr class="">evolution</a><br class="">
<br class=""></blockquote></div><br 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></body></html>