VarInsert
Insert an object into a container variable.
Syntax
-
VarInsert(X, i, x)
-
X
is a variable that is a linear container -
i
is an integer -
x
is a compatible object
-
If X
is an lvalue and a container, i
a valid index in a container of size #X + 1
, and x
a value that can be part of X
, then VarInsert(X, i x)
inserts x
at index i
in X
(so that i
becomes the index of x
in X
after the insertion). VarInsert
returns success
if successful.
This is the procedural version of insert
.
Examples
v ≔ SequenceVector(10)
(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)
VarInsert(v, 5, 100)
success
v
(1, 2, 3, 4, 100, 5, 6, 7, 8, 9, 10)