May I sent PR with group_count_by?
I think that's nice too.

2019年10月18日(金) 8:03 OvermindDL1 <overmind...@gmail.com>:

> To be specific, the `_by` part of these imply they would take a function
> to me as well, which I'm assuming for all these cases to just be the
> identity function for keeping the example simple.
>
> On a side note, I would really like a more proper `group_by` function that
> is RLE based, though unsure what to call it since `group_by` is already
> taken?
>
> On Thursday, October 17, 2019 at 5:01:26 PM UTC-6, OvermindDL1 wrote:
>>
>> Like given a list like:
>> ```
>> [1, 1, 1, 2, 2, 2, 2, 3, 3, 1, 1, 4, 4]
>> ```
>> I'd expect it to return:
>> ```
>> [{1, 3}, {2, 4}, {3, 2}, {1, 2}, {4, 2}]
>> ```
>>
>> This is similar to similar named functions in some other languages I use
>> though, so I am bias'ed that way
>>
>> (Technically `group_by` is misnamed in Elixir as well for what I'm
>> generally used to, I'm used to such a function being called `group_map` to
>> do the same thing, where `group_by` does RLE style grouping as well, where
>> `[1, 1, 1, 2, 2, 2, 2, 3, 3, 1, 1, 4, 4]` would actually return `[[1, 1,
>> 1], [2, 2, 2, 2], [3, 3], [1, 1], [4, 4]]`.  Elixir is a bit of an oddity
>> with a lot of naming conventions compared to what I'm used to.)
>>
>> On Thursday, October 17, 2019 at 4:44:50 PM UTC-6, José Valim wrote:
>>>
>>> Can you please expand what would be a RLE style count?
>>>
>>> On Fri, Oct 18, 2019 at 00:43 OvermindDL1 <overm...@gmail.com> 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 elixir-l...@googlegroups.com.
>>>> 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>
>>>> .
>>>>
>>> --
>>>
>>>
>>> *José Valim*
>>> www.plataformatec.com.br
>>> Skype: jv.ptec
>>> Founder and Director of R&D
>>>
>> --
> 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/0796f1bd-afa8-4cbd-b308-180371e9358c%40googlegroups.com
> <https://groups.google.com/d/msgid/elixir-lang-core/0796f1bd-afa8-4cbd-b308-180371e9358c%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-core+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elixir-lang-core/CADfR9tFPwSVzY58NczG7Jgg-wKgd%3D4ePxsVP6tVzgDJ4%2Boed6w%40mail.gmail.com.

Reply via email to