[swift-evolution] [Pitch] Add an all algorithm to Sequence

Vladimir.S svabox at gmail.com
Sat Apr 1 03:34:57 CDT 2017


On 01.04.2017 10:50, Brandon Trussell via swift-evolution wrote:
> I agree that based on the method name, I thought a collection would be
> returned.

 From the other side, for example C# has the similar IEnumerable.All() 
method which "Determines whether all elements of a sequence satisfy a 
condition."

>
> On Sat, Apr 1, 2017 at 12:36 AM, David Hart via swift-evolution
> <swift-evolution at swift.org <mailto:swift-evolution at swift.org>> wrote:
>
>
>
>     > On 1 Apr 2017, at 06:02, Will Stanton via swift-evolution <swift-evolution at swift.org <mailto:swift-evolution at swift.org>> wrote:
>     >
>     > +1 to adding, but the name `all` suggests (to me) the return of another sequence, not a Bool.
>
>     I'm not too concerned because the mandatory labels makes it clear.
>
>     > Perhaps the function name should be question-like?
>     >
>     > Suggesting: `membersSatisfy(condition:)` or `allSatisfy(condition:)`
>     or maybe even just `satisfies(condition:)`
>     > The question-like modifier/verb is necessary to suggest a Bool and
>     IMO not a needless word.
>     >
>     > Regards,
>     > Will Stanton
>     >
>     >> On Mar 31, 2017, at 11:28, Ben Cohen via swift-evolution
>     <swift-evolution at swift.org <mailto:swift-evolution at swift.org>> wrote:
>     >>
>     >> Hopefully non-controversial, aside from the naming of the method and
>     arguments, about which controversy abounds
>     >
>     > _______________________________________________
>     > swift-evolution mailing list
>     > swift-evolution at swift.org <mailto:swift-evolution at swift.org>
>     > https://lists.swift.org/mailman/listinfo/swift-evolution
>     <https://lists.swift.org/mailman/listinfo/swift-evolution>
>
>     _______________________________________________
>     swift-evolution mailing list
>     swift-evolution at swift.org <mailto:swift-evolution at swift.org>
>     https://lists.swift.org/mailman/listinfo/swift-evolution
>     <https://lists.swift.org/mailman/listinfo/swift-evolution>
>
>
>
>
> --
> Brandon
>
>
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution
>


More information about the swift-evolution mailing list