Skip to content

Instantly share code, notes, and snippets.

@michaeleisel
Last active August 29, 2015 14:04
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save michaeleisel/bf8b4b6162d841ee80a7 to your computer and use it in GitHub Desktop.
func generatorInclude<T, Y: Sequence where T: Equatable, T == Y.GeneratorType.Element>(seq: Y, element: T) -> Bool {
for e in seq {
if e == element {
return true
}
}
return false
}
extension Array {
func include(element: T) -> Bool {
return generatorInclude(self, element)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment