[swift-evolution] Reduce with inout

Georgios Moschovitis george.moschovitis at icloud.com
Sat Jan 21 00:40:15 CST 2017


> 
>> On 18 Jan 2017, at 12:45, Georgios Moschovitis <george.moschovitis at icloud.com> wrote:
>> 
>>> That’s what I thought also until just now, but then why wouldn’t you just use a for …  in loop?
>> 
>> the former gives a hint about what someFunction (and the for-loop) is doing.
> 
> 
> Whereas the latter explicitly lays out what is happening.

But, you have to actually read the loop to understand that it *is* reducing.
In this simple case, it’s obvious, but for more complex reduction, the ‘hint’ can be useful.

George


More information about the swift-evolution mailing list