I feel like the generic form here is Grouped Map Reduce. Something like:
Enum.group_map_reduce(list, group_key_fun, map_fun, initial_acc, reducer)
It could be used to do a single pass group_by/count for example:
Enum.group_map_reduce([1,1,2,3,5,5,8], &(&1), &(&1), 0, fn _, acc -> acc +
1 end)
That would produce:
%{1 => 2, 2 => 1, 3 => 1, 5 => 2, 8 => 1}
On Wed, Jun 22, 2016 at 1:56 PM Bartosz Kalinowski <[email protected]>
wrote:
> Oh thank you, I felt like this should be possible somehow using just the
> core. As you mentioned yourself there is still a permormance case
>
> --
> 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/35266cf0-7c8c-435f-8d73-9a621a72b65d%40googlegroups.com
> <https://groups.google.com/d/msgid/elixir-lang-core/35266cf0-7c8c-435f-8d73-9a621a72b65d%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>
--
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/CAOMhEnxbbB7%3DrzvT%3DJEV59U0LhwD1PQBqrZsbfZmGmRvYBYTZA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.