split_evenly is definitely clearer but I don't think it is common enough to
warrant inclusion into the standard library, especially when you can
achieve  it with two operations using take_every/drop_every.

And your English is perfectly fine! :)

On Thu, Dec 16, 2021 at 12:03 AM Masynchin <banzur.badu...@gmail.com> wrote:

> My english is not so good so I hope I understand it right (please correct
> me if I am wrong). If it is about using take/drop_every explicitly - I
> think name like split_evenly can be more describing in long pipes like 123
> |> Integer.digits() |> Enum.split_evenly |> Tuple.to_list() |>
> Enum.map(&Enum.sum/1) than 3-line function, to me it is faster to
> understand what is going on. But as I mentioned in PR I am new to Elixir
> and dont know much about Elixir style (paradigm, patterns, common way to
> write code) so I can be wrong about doing it an another function.
> четверг, 16 декабря 2021 г. в 01:45:52 UTC+3, José Valim:
>
>> Hi Masynchin,
>>
>> Thank you for the PR!
>>
>> I think this case can be conveniently done with two traversals, using
>> take_every/drop_every, as you showed, so that's what I propose people do.
>> If the code is very performance oriented, then custom recursion or a reduce
>> loop with two lists as accumulators is the way to go.
>>
>>
>>
>>
>> On Wed, Dec 15, 2021 at 11:37 PM Masynchin <banzur....@gmail.com> wrote:
>>
>>> I think I done it wrong order, so there is link to PR with explanation
>>> of when this function is helpful -
>>> https://github.com/elixir-lang/elixir/pull/11491
>>>
>>> --
>>> 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.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/elixir-lang-core/bd4d3e3a-7952-4eb3-80e3-c969a4035d6dn%40googlegroups.com
>>> <https://groups.google.com/d/msgid/elixir-lang-core/bd4d3e3a-7952-4eb3-80e3-c969a4035d6dn%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/3a55054f-8125-4192-9f7a-eabc798ff6d7n%40googlegroups.com
> <https://groups.google.com/d/msgid/elixir-lang-core/3a55054f-8125-4192-9f7a-eabc798ff6d7n%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/CAGnRm4Ldf_CfbFFzChENe2vOqUTkA9vDRxvrPBotAE8_h1KhZg%40mail.gmail.com.

Reply via email to