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

Robert Bennett rltbennett at icloud.com
Sun Apr 2 00:05:27 CDT 2017


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) }


More information about the swift-evolution mailing list