<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="">“Flatten”, in the context here (flattening a Sequence of Optionals), only makes sense if you consider Optional as a sequence of zero or one elements. While such a sequence does act very similarly to an Optional, the fact remains that Optional is <i class="">not</i>&nbsp;a Sequence, and is generally not treated as one by any other part of the language. It fundamentally makes no more sense to “flatten" a Sequence of Optionals than it does to “flatten" an Optional of a Sequence.<div class=""><br class=""></div><div class="">In my mind, <font face="Menlo" class="">filter</font> makes sense because I’m filtering out some of the results of the transformation operation <i class="">before</i>&nbsp;they get put into the resulting array. It’s a different kind of operation; not a <font face="Menlo" class="">map</font>, but a <font face="Menlo" class="">filterMap</font>. (Maybe <font face="Menlo" class="">filteringMap</font> would be clearer?) The operation is not “map into a new array, then filter”. It’s “run this transformation for each item. If it produces something, keep it.” There’s no <font face="Menlo" class="">filter</font> or <font face="Menlo" class="">compact</font>&nbsp;that runs on the entire collection.</div><div class=""><br class=""></div><div class="">-BJ</div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><br class=""><div><br class=""><blockquote type="cite" class=""><div class="">On Nov 14, 2017, at 7:50 AM, Tino Heth via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>&gt; 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; line-break: after-white-space;" class=""><div class=""><br class=""><blockquote type="cite" class=""><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; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">Yeah but it seems clear from the return type so I am not sure that much confusion would really exist.</span></div></blockquote></div><div class=""><br class=""></div>Afaics, there already is lots of confusion — that’s the reason for me to write a sequence of posts in this topic, instead of an Optional ;-)<div class="">The word „flatten“ is a quite honest description, so I wonder why words like filter, remove, ignoring or skipping should be used instead.</div><div class=""><br class=""></div><div class="">„Compact“ would be less irritating, but I could imagine that it indicates something like eliminating repeated occurrences.</div><div class=""><br class=""></div><div class="">Tino</div><div class=""><br class=""></div><div class="">(I’m quite close to attach a hand-drawn illustration of the flatMap process — I don’t think you want that to happen ;-)</div><div class=""><div class=""><br class=""></div></div></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>