Nothing is jumping out at me from elsewhere yet, but another option might be accepting options in `Enum.count`, like `Enum.count(list, max: 4)`. I’ll keep searching though.
On Thu, Dec 3, 2020 at 1:31 PM Zach Daniel <zachary.s.dan...@gmail.com> wrote: > I agree on the name feeling subpar :) I’ll take a look and see if I can > find other examples. > > On Thu, Dec 3, 2020 at 12:21 PM José Valim <jose.va...@dashbit.co> wrote: > >> Thanks Zach! I like this idea but the proposed name, for some reason, >> doesn't sit right with me. Is there any prior art from other langs we could >> look at? >> >> On Thu, Dec 3, 2020 at 6:15 PM Zachary Daniel <zachary.s.dan...@gmail.com> >> wrote: >> >>> Counting a list, especially a large one, to know if there are "more than >>> x" or "less than x" items is inefficient. >>> >>> Right now I often see things like `if Enum.count(list) > 4 ...`, mostly >>> because writing a recursive `more_than?` check is tedious, or doing >>> something like `Enum.empty?(Enum.drop(list, 4))` is not very expressive. >>> >>> I think it would be nice to have an `Enum.more_than?` that does that >>> work for you. It could also be `List.more_than?/2` if we don't want it in >>> Enum. Any thoughts? >>> >>> -- >>> 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/263d7c39-a32b-4294-93d8-40f248c9b3c8n%40googlegroups.com >>> <https://groups.google.com/d/msgid/elixir-lang-core/263d7c39-a32b-4294-93d8-40f248c9b3c8n%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/CAGnRm4JX4NE1yWH1G5L_DjF18v8zejF0%2BSkb_oz%3DPiUHM8Mz1w%40mail.gmail.com >> <https://groups.google.com/d/msgid/elixir-lang-core/CAGnRm4JX4NE1yWH1G5L_DjF18v8zejF0%2BSkb_oz%3DPiUHM8Mz1w%40mail.gmail.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/CAK-yb0C1esoDPvYvgo_NFF3Or%2B5TAdhSFY_%2BB-5SvhQTVQO4sg%40mail.gmail.com.