[swift-evolution] SE-0171: Reduce with inout

Guillaume Lessard glessard at tffenterprises.com
Fri Apr 14 16:07:02 CDT 2017


The mutating version would have a parameter label to differentiate it:

let a = [1, 2, 3, 4, 5]

let b = a.reduce(into: []) { (result, element) in
    result.append(element * 2)
}

--
GL



More information about the swift-evolution mailing list