Created
April 24, 2015 05:45
-
-
Save alexbosworth/e5506923941800d58500 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Find the index of the first element found in a collection | |
func findInCollection<T: CollectionType where T.Generator.Element: Equatable>(collection: T, val: T.Generator.Element...) -> T.Index? { | |
for v in val { if let index = find(collection, v) { return index } } | |
return nil | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment