Hacker News new | ask | show | jobs
by EdwardDiego 2093 days ago
`where` is intuitive as a synonym for `filter`, but it's the `select` that always threw me as a synonym for `map`.

I get that they're trying to expose an SQL-like API, but yeah, map is always about mutation, but `select`only does mutation sometimes in SQL.

2 comments

Map doesn't mutate, it returns the result of applying a function to the (possibly immutable) value. I believe you can also, say, `select icolumn * 2 from table`, where `icolumn * 2` provides precisely the same functionality as the function passed to a map.
`Where` at least answers the question "does filter _keep_ the things matching the predicate or _remove_ the things matching the predicate" - my pet hate with the .NET naming is `SelectMany` over `flatmap`.