inserts elem at position n in list. If n is negative, the position is counted from the end.
inserts elem at position in expr.
inserts elem at several positions.
- list can have any head, not necessarily List.
- Insert works on SparseArray objects by effectively inserting into the corresponding ordinary lists.
- If expr is an Association object, Insert[expr,key->value,pos] inserts an element in the association.
- If the specified position is of the form or Key[k], then Insert inserts a new element before the one corresponding to this key, or overwrites the value if this key is already present.
- If the key of the element to be inserted is already present, then the old element with the same key is deleted.
- Insert[elem,pos][expr] is equivalent to Insert[expr,elem,pos].
Introduced in 1988
(1.0)| Updated in 2014