I have an array and I want to remove a bunch of indices
var arr = [0,1,2,3,4,5,6] var rmIndices = [1,4,5]
What is the best way to remove in
rmIndices.sort({ $1 < $0 }) for index in rmIndices { arr.removeAtIndex(index) }
Note that I've sorted the indices in descending order. This is because everytime you remove an element E, the indices of the elements beyond E reduce by one.