Insert Command
- Insert( <Object>, <List>, <Position> )
-
Inserts the object in the list at the given position.
Insert(x^2, {1, 2, 3, 4, 5}, 3)
places x2 at the third position and creates the list {1, 2, x2, 3, 4, 5}.
If the position is a negative number, then the position is counted from the right. |
Insert(x^2, {1, 2, 3, 4, 5}, -1)
places x2 at the end of the list and creates the list {1, 2, 3, 4, 5,
x2}.
- Insert( <List>, <List>, <Position> )
-
Inserts all elements of the first list in the second list at the given position.
Insert({11, 12}, {1, 2, 3, 4, 5}, 3)
places the elements of the first list at the third (and following)
position(s) of the second list and creates the list {1, 2, 11, 12, 3, 4, 5}.
If the position is a negative number, then the position is counted from the right. |
Insert({11, 12}, {1, 2, 3, 4, 5}, -2)
places the elements of the first list at the end of the second list before
its last element and creates the list {1, 2, 3, 4, 11, 12, 5}.