How embarrasing I typo'd the subject. It should read Should zip / zip_with 
have a reducer?

Best

Adam

On Tuesday, February 2, 2021 at 10:27:49 PM UTC [email protected] wrote:

> Hello! 
>
> I was thinking about zip_with/3 et al. (don't judge me I'm in a lockdown). 
>
> Currently they work by returning a list, but would it not make more sense 
> for it to take an accumulator?
>
> ```elixir
> Enum.zip_with([1, 2], [3, 4], %{}, fn left, right, acc -> Map.put(acc, 
> left, right) end)
> %{ 1 => 3, 2 => 4 }
>
> Enum.zip_with([1, 2], [3, 4], [], fn left, right, acc -> [{left, right} | 
> acc] end)
> [{1, 3}, {2, 4}]
> ```
> If so... I guess it also opens to door for a zip_while.
>
> Am I mad? Has science gone too far?
>
> Best
>
> Adz
>
>
>

-- 
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/468649a3-7e6f-4214-99d8-6e8ef5e6d72an%40googlegroups.com.

Reply via email to