Avatar
swiftbot BOT 6/7/2018 2:20 PM
Author icon
koher
extension Sequence { public func compact<T>() -> [T] where Element == Optional<T> { return _compactMap { $0 } } } let a: [Int?] = [nil, 2, 3, nil, 5] let b: [Int] = a.compact() print(b)
Version:
swift-4.1.1-RELEASE
Output:
[2, 3, 5]
Error: