listlib::insertAt
-- insert an
element into a listlistlib::insertAt(
list, element, pos)
inserts element
into list
at position
pos
.
listlib::insertAt(list, element <, pos>)
list |
- | a list |
element |
- | any MuPAD object |
pos |
- | any integer |
the given list enlarged with the inserted element
listlib::insert
,
append
, _concat
listlib::insertAt
any element can be
inserted into any list at a specified place.1
the element is
inserted in front of the list. If the insertion index is greater than
nops(list)
the element is
appended to the list. To append an element to a list the kernel
function append
is
faster.element
is a list too, the elements of
this list will be inserted (or appended) instead of the whole list by
preserving the order.Insertion 2
at the third place of the given
list:
>> listlib::insertAt([1, 1, 1], 2, 3)
[1, 1, 2, 1]
Insertion of an element in front of a list. The third argument is optional in this case:
>> listlib::insertAt([1, 1, 3, 1], 2, 0), listlib::insertAt([1, 1, 3, 1], 2)
[2, 1, 1, 3, 1], [2, 1, 1, 3, 1]
Appending of an element. This could be done faster with
append
:
>> listlib::insertAt([1, 2, 3], 4, 1000), append([1, 2, 3], 4)
[1, 2, 3, 4], [1, 2, 3, 4]
linsert