views:

83

answers:

4

What was the rationale behind renaming of higher order list operations in C#? (Examples: map -> Select, filter -> Where, fold -> Aggregate)

+1  A: 

Well, IMO, "fold" is a pretty terrible name for "Aggregate". Freaking math people. :) Mostly though the C# names are more in-line with SQL/LINQ.

Kirk Woll
The C# names are more in line with _English_, let alone SQL/LINQ. But heaven forbid we should demystify our profession by actually using words ordinary people understand...
Lunivore
@Lunivore: I don't know. Without the connection to SQL, I don't think the name `Select` would give me an idea of what the method does - I probably would assume that it's `filter`, not `map`. `Where` is a bit more intuitive as a method name, but usually I'd say method names should be verbs (and `filter` is perfectly descriptive in my opinion). No argument about Aggregate vs. fold though (however I might have gone with Accumulate if it were up to me).
sepp2k
+5  A: 

LINQ tries to be roughly familiar to people knowing SQL, where projection is select, etc. You could write your own extension methods with names to suit, of course.

Marc Gravell
Ditto "where" etc
Marc Gravell
Considering that the overwhelming majority of LINQ users will be familiar with SQL and unfamiliar with traditional functional programming operators, this makes perfect sense.
Gabe
+2  A: 

Not an answer, but a worthy aside:

See http://blogs.msdn.com/b/jaredpar/archive/2008/12/02/mapping-linq-to-f.aspx for a 'decoder ring' translation between LINQ (as in C#/Enumerable) and F# Seq functions (which mostly follow the more traditional functional names).

Brian
+4  A: 

Regarding the meta-question...

The functional programming community and mainstream imperative programming community have evolved in near-isolation from one another for a long time. As a result, there are fundamental vocabulary differences; for example, a common term like "polymorphism" means completely different things to each group (parametric polymoprhism, a.k.a. "generics" or "templates" to the FP-ers; versus subtype polymorphism to the rest).

Asking for the rationale behind names (if there even is one) often results in one simple answer - you name stuff according to the "local culture". In C#, LINQ is a query language like SQL, so it looks a lot like SQL.

But asking this question is roughly analogous to going to Spain and asking what the rationale is for everyone calling his house "mi casa". ("What do you mean why do I call it that? That's what it's called! You mean you call it something different?")

Brian