Hi Randson, Is there an argument against using "not Enum.empty?(coll) and Enum.all?(coll)", which would be by far the most readable implementation of what is being proposed?
I would like to see the cons to the suggestion above that justify the benefits of adding a default argument or an option to the standard library. Thank you. On Thu, Jan 21, 2021 at 2:00 PM Randson <[email protected]> wrote: > Yeah, I agree with you guys. The words are synonyms and I think we can add > an option to all?/2, where default for breaking changes is false and if you > really need that empty lists should return false. If specify it on an third > argument. > > I could prepare a PR this week implementing that. > > What do you guys think? > > On 21 Jan 2021, at 09:57, Jon Rowe <[email protected]> wrote: > > I think this is too confusing compared to `all?`, the words are synonyms > but I agree that having `all?` return `true` for an empty list can create > extra cruft unless you create your own wrapper functions, personally I > wouldn’t mind an option to configure it with a default to true, such as > `Enum.all?(enum, fnx, on_empty: false)` > > Regards > Jon > ---------------- > [email protected] > https://jonrowe.co.uk > > On 21 January 2021 at 12:51, Felipe Stival wrote: > > Personally, I don't like having both `every?` and `all?`, I think it would > be ambiguous. And I think the use-case does not justify this ambiguity. > > > -- > 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/dejalu-217-153a6b1d-c305-4299-9e78-4e70469e4b0f%40jonrowe.co.uk > <https://groups.google.com/d/msgid/elixir-lang-core/dejalu-217-153a6b1d-c305-4299-9e78-4e70469e4b0f%40jonrowe.co.uk?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 [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/elixir-lang-core/BC4ED8BF-B651-4035-8726-7FDDA5580368%40gmail.com > <https://groups.google.com/d/msgid/elixir-lang-core/BC4ED8BF-B651-4035-8726-7FDDA5580368%40gmail.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 [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/elixir-lang-core/CAGnRm4%2BNyu_w%3DeAj0cSHDJqDXT5K34o7cDku48B6wRVCrtEaSQ%40mail.gmail.com.
