Conversation
Add a method to element-mutable collections that takes a closure that can fuse two element values and applies it to the collection, i.e. progressive reduce, a.k.a. scan. Add another method that takes a closure that can separate an element value from another and applies it to a collection, doing the inverse of the first method.
|
As has been discussed in this repo, a “scan” function is going to be named In general, if you haven’t already, I recommend taking a look at the existing work and discussions that are ongoing. It’s helpful because you can get a sense of how to build on that work rather than duplicating it. If there’s new functionality that seems to be missing, it is nice to discuss it with the community under “Issues” before dropping new code into a PR, as there are multiple ways to design any one feature and some will fit better with Swift’s direction than others. |
|
I used "scan" in the title because it's technically a term-of-art, so casuals reading the PR list would have more of an idea what's going on. The PR with |
Description
Adds new API for element-mutable collections that takes a closure that fuses element values and performs a
scan(i.e. a progressivereduce) in-place. The other new method performs the inverse operation, taking a closure that removes the contribution one element value plays on another.Detailed Design
Documentation Plan
The methods, types, and the types' properties have block documents. There is also a guide file.
Test Plan
A test file is included.
Source Impact
It adds API.
Checklist