

Insert
Details

- 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 "key" 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].
Examples
open all close allBasic Examples (10)
Insert x to be at position 2 from the end:
Insert x at several positions:
Inserting entries with repeating keys in an Association overrides earlier values:
Insert in an Association using position:
Generalizations & Extensions (2)
Related Links
History
Introduced in 1988 (1.0) | Updated in 2003 (5.0) ▪ 2014 (10.0)
Text
Wolfram Research (1988), Insert, Wolfram Language function, https://reference.wolfram.com/language/ref/Insert.html (updated 2014).
CMS
Wolfram Language. 1988. "Insert." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2014. https://reference.wolfram.com/language/ref/Insert.html.
APA
Wolfram Language. (1988). Insert. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/Insert.html
BibTeX
@misc{reference.wolfram_2025_insert, author="Wolfram Research", title="{Insert}", year="2014", howpublished="\url{https://reference.wolfram.com/language/ref/Insert.html}", note=[Accessed: 18-August-2025]}
BibLaTeX
@online{reference.wolfram_2025_insert, organization={Wolfram Research}, title={Insert}, year={2014}, url={https://reference.wolfram.com/language/ref/Insert.html}, note=[Accessed: 18-August-2025]}