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

Nevin Brackett-Rozinsky nevin.brackettrozinsky at gmail.com
Sat Apr 1 12:58:37 CDT 2017

If indeed “all(equal:)” is rarely needed, then perhaps it is best to leave
it out *and also* leave out the argument label from “all(matching:)”. Then
the signature would be similar to,

func all(_ predicate: (Element)->Bool) -> Bool

and the points-of-use would look like:

nums.all( isEven )
nums.all{ $0 == 9 }
nums.all{ n in n*n < 2 }

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20170401/ba99916b/attachment.html>

More information about the swift-evolution mailing list