I also think that the name `count_by` does not describe it well. It looks like 
a function that receives a function to filter in which items to count. Like in:

   iex> Enum.count_by(1..10, &rem(&1, 2))
   5

`group_count_by` is clearer IMO. But maybe `count_group_by` is more 
semantically correct, since “group count” seems like “the quantity of groups”.

Best,
Kelvin Stinghen
[email protected]

> On Oct 17, 2019, at 19:43, OvermindDL1 <[email protected]> wrote:
> 
> I personally think the `count_by` name implies some other operation then a 
> grouped count (to me I'd expect an RLE style count), I like the prior 
> mentioned `group_count_by` or `group_count`.
> 
> On Thursday, October 17, 2019 at 2:07:56 PM UTC-6, José Valim wrote:
> Hi Osawa,
> 
> Please send a pull request for Enum.count_by:
> 
> iex> Enum.count_by(~w{aa aA bb cc}, fn x -> String.downcase(x) end)
> %{"aa" => 2, "bb" => 1, "cc" => 1}
> 
> It is meant to mirror group_by.
> 
> If someone has an objection against count_by, please let us know.
> 
> -- 
> 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 [email protected] 
> <mailto:[email protected]>.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/elixir-lang-core/fafa74a1-4a27-4f14-8844-1ecac91ffba2%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/elixir-lang-core/fafa74a1-4a27-4f14-8844-1ecac91ffba2%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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elixir-lang-core/A0FD01DF-3FB1-4282-8C7D-676F55241558%40gmail.com.

Reply via email to