4 ms·
I spend most of my time in C# and it's always a sad moment when I start typing .Where(x => ...) in another language and realize it doesn't exist.
by troycarlson 12y ago
I spend most of my time in C# and it's always a sad moment when I start typing .Where(x => ...) in another language and realize it doesn't exist.
- frou_dh 12y agoIt's spelled filter http://en.wikipedia.org/wiki/Filter_%28higher-order_function%29 http://en.wikipedia.org/wiki/Filter_%28higher-order_function...
- untog 12y agoI don't mind C# not using that name because .Where doesn't actually filter the object, it returns an IQueryable, which you can chain further statements onto, then filter.
- DennisP 12y agoThat's basically what filter does in Clojure (and probably any other language with lazy evaluation): http://debasishg.blogspot.com/2010/05/laziness-in-clojure-some-thoughts.html http://debasishg.blogspot.com/2010/05/laziness-in-clojure-so...
- _random_ 12y agoNah, it's spelled Select: http://www.w3schools.com/sql/sql_where.asp http://www.w3schools.com/sql/sql_where.asp (but academics like non-human-friendly terms, sure)
- frou_dh 12y agoNo idea what point you're trying to make. On human-friendliness, filter can read as a physical metaphor, so scores rather well. Just need to remember whether what's caught is kept or discarded.
- seanmcdirmid 12y agoNo. Select == Map Where == Filter SelectMany == FlatMap Aggregate == FoldL
- taco_emoji 12y agoNot sure why this is getting downvoted, that's what it's called in most other languages.
- antics 12y agoThe LINQ API is modeled after relational algebra (where `Select` acts as projection, and `Where` acts as selection, etc.), which is as good a basis for operations on collections as anything. It is not even clear that other popular names have precedent, let alone especially useful expressive power beyond what normal relational algebras afford. Besides that, one of the early intents behind LINQ was to allow a language-integrated ORM, so LINQ's choices for names are actually extremely appropriate.
- frou_dh 12y agoThe comment replied to was about missing its like in other languages. Didn't mean to imply that its name should be changed in C#.
- dingleberry1j 12y agoEven c++ has lambdas now... what's the big deal again?