Skip to content

Instantly share code, notes, and snippets.

@Julioacarrettoni
Created December 22, 2015 21:32
Show Gist options
  • Save Julioacarrettoni/10647e5d56bb4ee1294f to your computer and use it in GitHub Desktop.
Save Julioacarrettoni/10647e5d56bb4ee1294f to your computer and use it in GitHub Desktop.
Playing with lazy and "real" flat maps
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