Created
December 22, 2015 21:32
-
-
Save Julioacarrettoni/10647e5d56bb4ee1294f to your computer and use it in GitHub Desktop.
Playing with lazy and "real" flat maps
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
let mixedArray = [1, "2", 3, "4", 5, 6] | |
let resultA = mixedArray.flatMap({ $0 as? String }) | |
resultA.first | |
let resultB = mixedArray.lazy.flatMap({ $0 as? String }) | |
resultB.first |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment