There are already some functions that take a filter function with the 
operation, like `Enum.count/1` and its filtered version, or `Enum.count/2`. 
Some other functions, like `Enum.max` or `Enum.frequencies` have a `_by` 
version that takes an additional argument. 

It would be cool and much more succinct, also for the library, if we could 
generalise this behavior to all functions, and have a function that takes a 
function name as an atom, its "operating" function, and a filter function, 
i.e. something like this:
```
Enum.operation_by(:map, &String.downcase/1, &filter_fun/1)
```
which I think would consistently reduce the dimension of the API. People 
often use filtering before doing stuff with Enum. This doesn't bring any 
new function, but rather generalises a behaviour and reduces the amount of 
stuff one would need to remember or know about the Enum API (which by the 
way, it's a work of art as it is TBH).

 

-- 
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/d6ae0579-04d7-4a2c-944a-f7279c789004n%40googlegroups.com.

Reply via email to