[swift-evolution] [Draft] Apply -ed/-ing rule to core functional methods (e.g. filter => filtered)

Brent Royal-Gordon brent at architechies.com
Thu Jun 16 20:24:15 CDT 2016


> The 'reduce()' at its core take an array of element and reduce it to single element (could be of a different type) as such it cannot ever be mutating (if one really want it, one could reduce an array to the same array but it is not the goal of the function). For this one it sound to me nearly like asking to rename 'max()' to 'maxed()', 'count' to 'counted' or implement a 'summed()' instead of a 'sum()' for [Int].

`max`, `count`, and `sum` are all nouns—at least in the senses they are meant in those calls—so they do not take the -ed/-ing suffixes to form immutable variants. Instead, they would take the `form` prefix to form mutable variants, if they had them.

`map`, `filter`, and `reduce`—at least in the senses they must be interpreted in for the names of those calls to make sense—are verbs, and so they *would* normally take -ed/-ing suffixes. However, as broadly-accepted terms of art, we have left them alone until now.

-- 
Brent Royal-Gordon
Architechies



More information about the swift-evolution mailing list