[swift-evolution] [swift-evolution-announce] [Accepted and Focused Re-review] SE-0187: Introduce Sequence.filterMap(_:)

Benjamin G benjamin.garrigues at gmail.com
Tue Nov 21 04:47:46 CST 2017

I have a question regarding the general term "compact" vs something more
specific like "remove nil" :
Could we imagine other usages on different types for "compact" ?

map / flatmap has the whole category theory behind it, making it meaningful
for many different types. "Filter" is also generic, because the operation
of filtering has a wide range of application.

"Compact", like Tino suggested, would have the general meaning of "reducing
the size by removing similar elements". Removing nils doesn't seem to be a
special case of this general definition.

If we give "compact" the strict definition of "removing nil", then i don't
understand the need for a general term, instead of something like
"dropNils" (not much longer to write).

On Tue, Nov 21, 2017 at 10:47 AM, Tino Heth via swift-evolution <
swift-evolution at swift.org> wrote:

> My favorite would be a variation of Scalas choice (collect /
> collectResults).
> The word compact (or similar choices like condense, squeeze, pack,
> compress…) always remind me on compression — my first association of
> „compact“ would be a transform that turns [1, 2, 2, 3] into [1, 2, 3] (like
> the shell tool uniq).
> But there’s a long list of verbs with similar meaning, so if there’s a
> consensus for compact (or compacted…), I join that camp.
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20171121/a384828d/attachment.html>

More information about the swift-evolution mailing list