Last active
August 29, 2015 14:25
-
-
Save ilyapuchka/fcb4c50ca5fb49ecc072 to your computer and use it in GitHub Desktop.
Guess what it does
This file contains hidden or 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
func z_map<S : SequenceType, T>(source: S, transform: (S.Generator.Element) -> T?) -> [T] { | |
// easy, right? =) | |
return reduce(source, []) { r, i in map( transform(i) ) { r + [$0] } ?? r } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment