Also worth noting, `filter` has a long history of use and is common in functional languages:
https://en.wikipedia.org/wiki/Filter_(higher-order_function) I agree that the common meaning of filter in English (and German, apparently) clashes somewhat with its use in functional languages. It was a stumbling point for me too. But it's the classic trade-off of "what people have grown accustomed to" vs. "what a newcomer might find intuitive". Ideally, Elixir is easy to pick up for both first-time functional language users and those who already have some experience. On Saturday, February 3, 2024 at 3:48:33 AM UTC-5 and...@andrewtimberlake.com wrote: > I didn’t mean it was clearly out or clearly in, but covers both and you > can use the same function whichever way you want it to work. > > —Andrew > > On February 3, 2024, Nick West <njw...@gmail.com> wrote: > > On the semantic side, I respectfully disagree with Andrew that filter is > clearly filter out or filter in, in common usage in both English and in > German filter can easily imply either action in either direction, e.g. > selection or removal (source: am native english speaker with english > degree, german as second language). > I’ve found filter to be a flimsy word in both JS and Elixir, am mildly > relieved to find I’m not the only one > > On Sat, 3 Feb 2024 at 3:06 AM Andrew Timberlake < > and...@andrewtimberlake.com> wrote: > > I doubt an alias will be accepted. >> >> What’s interesting is that Javascript doesn’t have select or reject, but >> only filter. >> Filter actually works exactly like you say it does in language (both >> German and English) >> >> <what I want> = Enum.filter(& &1 == <select>) >> <what I want> = Enum.filter(& &1 != <reject>) >> >> Just an observation >> >> —Andrew >> >> On February 3, 2024, Michael Neumann <michae...@gmail.com> wrote: >> >> Hi, >> >> I am proposing to add Enum.select as an alias for Enum.filter. >> >> Why? In my native language (German), when we talk about "filtering", its >> exact meaning can be context dependent: >> >> - Water filter - Filters substances out of unclean water. (rejects all >> but water) >> - Particle filter - Rejects particles from a gas. Sometimes also called >> an "air filter" >> - Coffee drip filter - Rejects the coffee powder >> >> So it's not always clear what the filter rejects or selects. A *particle >> filter*, *rejects* particles, while a *water filter* *selects* water (it >> actually does not filter water, but dirty water). We also use the verb "to >> filter out" (herausfiltern), which has the opposite meaning of "to filter". >> >> - This ambiguity in my native language, which likely also applies to >> English, makes my brain sometimes spend unnecessary cycles. Dunno if it's >> just me. >> - Coming from Ruby, select seems to be a natural choice >> - While we have Enum.reject, it's natural counterpart Enum.select is >> missing. >> >> IMHO: >> [:water, :bacteria] |> Enum.select(& &1 == :water) >> >> has higher chances to be understood well by beginners over: >> >> [:water, :bacteria] |> Enum.filter(& &1 == :water) >> Regards, >> Michael -- >> You received this message because you are subscribed to the Google >> Groups "elixir-lang-core" group. >> To unsubscribe from this group and stop receiving emails from it, send >> an email to elixir-lang-co...@googlegroups.com. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/elixir-lang-core/28f58f84-7666-4609-89a1-81d8835a0551n%40googlegroups.com >> >> <https://groups.google.com/d/msgid/elixir-lang-core/28f58f84-7666-4609-89a1-81d8835a0551n%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> >> -- >> You received this message because you are subscribed to the Google Groups >> "elixir-lang-core" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to elixir-lang-co...@googlegroups.com. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/elixir-lang-core/CAOwN-EScg6FK6c3G0RMOvkhGUj0J3JRt%3DuEn9-qSzNNpmAe3xQ%40mail.gmail.com >> >> <https://groups.google.com/d/msgid/elixir-lang-core/CAOwN-EScg6FK6c3G0RMOvkhGUj0J3JRt%3DuEn9-qSzNNpmAe3xQ%40mail.gmail.com?utm_medium=email&utm_source=footer> >> . >> > -- > You received this message because you are subscribed to the Google Groups > "elixir-lang-core" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to elixir-lang-co...@googlegroups.com. > > To view this discussion on the web visit > https://groups.google.com/d/msgid/elixir-lang-core/CABdhv4Nx6uWDdckO2bevrXaE9wmPVEiTOrauGEOFY%3DHN24aBow%40mail.gmail.com > > <https://groups.google.com/d/msgid/elixir-lang-core/CABdhv4Nx6uWDdckO2bevrXaE9wmPVEiTOrauGEOFY%3DHN24aBow%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > > -- You received this message because you are subscribed to the Google Groups "elixir-lang-core" group. To unsubscribe from this group and stop receiving emails from it, send an email to elixir-lang-core+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/elixir-lang-core/83dc9780-d164-4af7-b4ae-b664887de7e9n%40googlegroups.com.