[swift-users] edit array

Rien Rien at Balancingrock.nl
Wed Apr 26 09:54:34 CDT 2017


Agree, though the function should probably be named something like: withEach instead of forEach.
Maybe worth a proposal on evolution?

Regards,
Rien

Site: http://balancingrock.nl
Blog: http://swiftrien.blogspot.com
Github: http://github.com/Balancingrock
Project: http://swiftfire.nl - A server for websites build in Swift






> On 26 Apr 2017, at 16:47, J.E. Schotsman via swift-users <swift-users at swift.org> wrote:
> 
> 
> On 26 Apr 2017, at 16:27, Rien <Rien at Balancingrock.nl> wrote:
> 
>> To edit the value in the array itself use:
>> 
>> array[index].number += 1
> 
> That requires a for loop.
> Functional programming lets you write for loops more succinctly.
> Why can’t $0 not be used as a reference, like array[index] ?
> I've checked, it’s not among the commonly rejected proposals.
> 
> Jan E.
> 
> _______________________________________________
> swift-users mailing list
> swift-users at swift.org
> https://lists.swift.org/mailman/listinfo/swift-users



More information about the swift-users mailing list