Updating removeAll(where:) to return removed elements

I’ve started a pitch thread so anyone with thoughts on this matter should chime in over there as well.

This code is not correct, which I think illustrates the utility of a function like this. At the end, taskList will contain all the tasks for which isReady == true, the exact opposite of the desired behavior. The dual iteration is also inefficient if taskList is large, or if the predicate was checking $0.expensiveOperationReturningBool() rather than $0.isReady.

1 Like