Created
December 22, 2015 21:35
-
-
Save Julioacarrettoni/8a68609ee8246890443d to your computer and use it in GitHub Desktop.
Possible bug on Swift 2?
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 array = [1, 2, 3, 4, 5, 6] | |
array.map { (value) -> [Int] in | |
print(value) | |
return [value] | |
} | |
array.lazy.map { (value) -> [Int] in | |
print("value: \(value)") | |
return [value] | |
}.first | |
array.lazy.flatMap { (value) -> [Int] in | |
print("value: \(value)") | |
return [value] | |
}.first | |
array.lazy.flatMap { (value) -> [Int]? in | |
print("value: \(value)") | |
return value > 3 ? [value] : nil | |
}.first |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment