Skip to content

Instantly share code, notes, and snippets.

@nanoxd
Created December 10, 2018 12:17
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nanoxd/ec458c20c401ce06eeda86a12c7ce74d to your computer and use it in GitHub Desktop.
Save nanoxd/ec458c20c401ce06eeda86a12c7ce74d to your computer and use it in GitHub Desktop.
[Collection.anySatisfy] With the introduction of allSatisfy, we can cleanly represent the inverse.
extension Collection {
func anySatisfy(_ p: (Element) -> Bool) -> Bool {
return !self.allSatisfy { !p($0) }
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment