Created
July 4, 2015 09:48
-
-
Save oisdk/e369d36324d5d2a63a2d 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
extension GeneratorType { | |
mutating func find(pred: Element -> Bool) -> Element? { | |
return next().flatMap { el in pred(el) ? el : find(pred) } | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment