-1 from me on the .every? function, and the option. Go with mathematical logic in this case.
-bt On Thu, Jan 21, 2021 at 1:39 AM Randson <[email protected]> wrote: > Hi all, recently I opened I pull request on Elixir repo. Which is: > > https://github.com/elixir-lang/elixir/pull/10664 > > Adding the Enum.every? function on the Enum module. > > I had case where, given a list of atoms, all of the needs to return true: > > Enum.every?([:some, :some, :some], fn x -> x == :some end) > ...> true > > Enum.every?([]) > ...> false > > I tried with functions like Enum.all?/2 and Enum.any?/2. But the cases are > follow: > > Enum.all?/2 - Returns true in case of an empty list; > Enum.any?/2 - Returns false, which is correct but if there is a different > value on the list. Probably this will return true. > > So I took the name every because I'm used to use like this on JS. But as > Valim mentioned on the PR, it could be all_non_empty? or something else. > > What do you guys think? > > -- > 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/977fcb5e-3d81-4017-b993-7d27a695937an%40googlegroups.com > <https://groups.google.com/d/msgid/elixir-lang-core/977fcb5e-3d81-4017-b993-7d27a695937an%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- Regards, Bruce Tate CEO <https://bowtie.mailbutler.io/tracking/hit/f8218219-d2a8-4de4-9fef-1cdde6e723f6/c7c97460-016e-45fb-a4ab-0a70318c7b97> Groxio, LLC. 512.799.9366 [email protected] grox.io -- 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/CAFXvW-5HiO_QLJ9%3DGpxkQuFv2s4Zjbxve5d_WWavO0UCAGc0Hg%40mail.gmail.com.
