Question: How to remove several entries from an array efficiently?

Consider 1-dimensional arrays in Maple. To add one element at the end of an array, there is a pre-defined command ArrayTools:-Append (or using ArrayTools:-Insert if one wants to add an element at another location of the array) and to remove one entry from an array there is another pre-defined command ArrayTools:-Remove. Now let's say I want to add several elements and remove several elements. If I want to add all of the new elements at the end of the array, there is a predefined command ArrayTools:-Extend. If I want to remove several entries that are sequal, then I can give the second argument of ArrayTools:-Remove as a range n1..n2. But now let's say I want to remove several entries that are not sequal, for examples entries with indices in [5,8,14]. Is there any special efficient way to do it or just defining a loop to do the removals one by one? Removing by a loop is not very nice since the number of indices will change after each removal. Then another idea is to redefine the whole array using a select or a seq. But I'm guessing that none of these are the best way to do so. If I was dealing with MutableSet, I would use &minus, but I can't use MutableSets in every situation, because MutableSets change the order of elements and have more special properties like no repeated elements etc.

Please Wait...