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@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@swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution
>
_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution

Reply via email to