[swift-evolution] Sequence/Collection Enhancements

David Waite david at alkaline-solutions.com
Fri Feb 17 17:13:58 CST 2017


> On Feb 16, 2017, at 5:39 PM, Ben Cohen via swift-evolution <swift-evolution at swift.org <mailto:swift-evolution at swift.org>> wrote:
> 
> Hi swift-evolution,
> 
> Following up on Ted’s post regarding the opening up of stage 2, I’m starting a thread to discuss additive algorithms for Sequence and Collection.
> 
> Here is a list of commonly requested algorithms to operate on Sequence or Collection:
> 
> In-place transformations:
> transform elements in a MutableCollection using a closure i.e. in-place map
I assume this would be an (Element)->Element transform?

> Check if all elements in a Sequence match a predicate (i.e. !contains(!predicate))
I created this one to clean up some Sequence code earlier this week

> Is writing the equivalent by hand hard to make efficient? Are there common performance traps that this addition would help avoid?
I suspect this is where remove(where:) and remove(indices:) for example would really shine as additions.

-DW
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20170217/7c800cd2/attachment.html>


More information about the swift-evolution mailing list