> Is there an argument against using "not Enum.empty?(coll) and Enum.all?(coll)"

Nothing. When I came to this. I thought it would be good to having a function 
to return false when a list is empty and the probably the same implementation 
of all?/2, because in my personally case the all?/2 returning true for empty 
lists doesn’t worked.

So, I searched on the Enum module to find this function and didn’t found 
nothing related. That’s why we’re here.

Well, I’ll use this way from now on. Thanks for the discussion and your time 
guys.

> On 21 Jan 2021, at 10:08, José Valim <[email protected]> wrote:
> 
> 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] 
> <mailto:[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] 
>> <mailto:[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] <mailto:[email protected]>
>> https://jonrowe.co.uk <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] 
>> <mailto:[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] 
> <mailto:[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] 
> <mailto:[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
>  
> <https://groups.google.com/d/msgid/elixir-lang-core/CAGnRm4%2BNyu_w%3DeAj0cSHDJqDXT5K34o7cDku48B6wRVCrtEaSQ%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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elixir-lang-core/4EE0F7EE-D938-4D40-BFFD-3CDAEF05C3C0%40gmail.com.

Reply via email to