ArrayTools
Remove
remove entries and shrink an Array
Calling Sequence
Parameters
Description
Examples
Compatibility
Remove( A, i)
Remove( A, a..b)
A
-
1-D Array or Vector
i, a, b
integer index
The Remove command deletes the entries at index i, or index range a..b. After this operation, upperbound(A) will be smaller by the number of elements deleted.
If A is an array or vector with an index range starting at zero or higher, then negative indexing can be used to specify the index to remove. For example, Remove(A,-1), will remove the last element, and Remove(A,-2..-1) will remove the last two elements.
This operation works in-place and will cause all references to A to be modified accordingly.
The Remove command only works on 1-D Arrays and Vectors with rectangular dense storage and no indexing function.
This function is part of the ArrayTools package, so it can be used in the short form Remove(..) only after executing the command with(ArrayTools). However, it can always be accessed through the long form of the command by using ArrayTools[Remove](..).
withArrayTools:
A≔Array11,22,33,44,55
A≔1122334455
Remove A[3] and shrink:
RemoveA,3
11224455
A is permanently changed:
upperboundA
4
ArrayDimsA
1..4
numelemsA
Remove a range of elements
RemoveA,1..2
4455
Remove the last element
RemoveA,−1
44
Add some elements back
A2≔55
A2≔4455
A3≔66
A3≔445566
445566
Remove the last two elements
RemoveA,−2..−1
The ArrayTools[Remove] command was introduced in Maple 2019.
For more information on Maple 2019 changes, see Updates in Maple 2019.
See Also
ArrayDims
ArrayTools[Size]
lowerbound
numelems
rtable_indexing
upperbound
Download Help Document