Bikeshed opportunity: filter/map/reduce naming (original) (raw)

Doug Lea dl at cs.oswego.edu
Fri Nov 30 16:54:43 PST 2012


On 11/30/12 18:27, Brian Goetz wrote:

[ Second try, hopefully right list this time ]

Hey, kids, its bikeshed time again! The topic today is: filter, map, reduce. Should they be called something else? (No, Don, we're not going with the Dr. Seuss names. :) But, people have complained about filter because they can't tell whether we are filtering OUT the elements matching the predicate, or including them. Some of these people have suggested "where(Predicate)" as an alternative. Which seems OK to me.

"select" is the most classic name. Especially for a database company :-) Also "selectAny" etc.

Others find "map" too math-y. (The alternatives I can think of are also math-y; project, transform, apply).

Do they think that "java.util.Set" is too mathy?

Further, "reduce" and "fold" are unfamiliar to many Java developers. The .NET folks went with "aggregate" to describe their reduction/folding operations.

Stick with "reduce". Nothing else means the same thing with such clarity. "aggregate" is crummy because it is a noun and verb. "fold" is also crummy because it has too many slightly different definitions out there.

-Doug



More information about the lambda-libs-spec-observers mailing list