[swift-evolution] Adding a new filter method which returns 2 arrays

Arman Shan armanshan12 at gmail.com
Sat Jan 16 22:55:35 CST 2016


The dictionary return will be a more complicated version of the partition method. The reason I thought the partition method would be a trivial addition to the stdlib is because filter pretty much does all that work; it just doesn’t return the “other” items. so this function would be sort of a “filter2”.



> On Jan 16, 2016, at 7:46 AM, Tino Heth <2th at gmx.de> wrote:
> 
> I would prefer a more general approach:
> Return value could be a dictionary whose values are arrays, and the supplied function could by anything that maps target contents to possible keys (Bool would be possible, but also attributes like "lastName", "age"…).
> But it isn't that hard to write this on your own, so I'm not sure if it's fundamental enough for stdlib...
> 
> Tino



More information about the swift-evolution mailing list