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

BJ Homer bjhomer at gmail.com
Fri Apr 14 16:08:54 CDT 2017


Ah, that makes sense. I was forgetting that the parameter label was on the initial value. 

+1 from me!

-BJ

> On Apr 14, 2017, at 3:07 PM, Guillaume Lessard via swift-evolution <swift-evolution at swift.org> wrote:
> 
> 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
> 
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution



More information about the swift-evolution mailing list