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

Richard Wei rxrwei at gmail.com
Sun Apr 2 04:17:55 CDT 2017


`withoutException` sounds confusing to me. And it’ll potentially make a Swift newcomer think it has something to do with runtime exceptions.

IMO `forAll(_:)` is the best name. It looks logically, quantificationally clear. With regard to the possible confusion w/ `forEach`, the “each" in `forEach` conveys the sense of iteration, while the “all” in `forAll` conveys both iteration and conjunction.

-Richard

> On Apr 2, 2017, at 00:05, Robert Bennett via swift-evolution <swift-evolution at swift.org> wrote:
> 
> It figures, the hardest thing to pick is the name of this function…
> 
> I like forAll the best so far, but I worry that it sounds too much like forEach and would be confusing.
> 
> What does everyone think of withoutException? nums.withoutException(isEven) and nums.withoutException { isEven($0) } make their purpose clear, and even make clear what happens for an empty Collection.
> 
> Other options that come to mind that I am less enthusiastic about:
> 
> nums.every(satisfies: isEven) / nums.every { isEven($0) }
> nums.entirely(isEven) / nums.entirely { isEven($0) }
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 455 bytes
Desc: Message signed with OpenPGP
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20170402/4e2e0d04/attachment.sig>


More information about the swift-evolution mailing list