i have array , want remove bunch of indices
var arr = [0,1,2,3,4,5,6] var rmindices = [1,4,5]
what best way remove indices 1,4,5 arr?
rather list of indices remove, may easier have list of indices keep, can using set
type:
let rmindices = [1,4,5] let keepindices = set(arr.indices).subtract([1,4,5])
then can use permutationgenerator
create fresh array of indices:
arr = array(permutationgenerator(elements: arr, indices: keepindices))