And yes, you're right about Advent Of Code! :-)

On Saturday, 1 December 2018 16:27:28 UTC, Parker Selbert wrote:
>
> I can't help but think that this request and the earlier doc improvements 
> to `Enum.reduce_while/3` are stemming from the first challenge in the 
> Advent of Code.
>
> Anyhow, is `Enum.sum/2` that much more expressive than `Enum.reduce/3`?
>
> Enum.reduce([1, 2, 3], 0, &(&1 * 2 + &2))
>
> — Parker
>
> On Sat, Dec 1, 2018, at 10:18 AM, Sean Handley wrote:
>
> Hello,
>
> I'd like to propose *Enum.sum/2*, where the second argument is a function.
>
> This will allow writing
>
>
> Enum.sum([1, 2, 3], &(&1 * 2))
>
>
> instead of
>   
>
> Enum.map([1,2,3], &(&1 * 2)) |> Enum.sum()
>
>
> The advantages are:
>
> - Write less code.
> - One few iteration across the collection.
>
> I have a branch prepared - 
> https://github.com/elixir-lang/elixir/compare/master...seanhandley:map_with_func
>
> Please let me know your thoughts.
>
> Cheers,
> Sean
>
>
> --
> 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 <javascript:>.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/elixir-lang-core/a6cb1e15-f32a-4e27-848d-ac8b80f080c0%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/elixir-lang-core/a6cb1e15-f32a-4e27-848d-ac8b80f080c0%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 elixir-lang-core+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elixir-lang-core/7053f5a2-10da-47cb-9afd-dcf8467c4789%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to