This is documentation for Mathematica 5, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.2)

Documentation / Mathematica / Built-in Functions / Lists and Matrices / List Operations /


FilledSmallSquare Insert[list, elem, n] inserts elem at position n in list. If n is negative, the position is counted from the end.

FilledSmallSquare Insert[expr, elem, i, j, ... ] inserts elem at position i, j, ... in expr.

FilledSmallSquare Insert[expr, elem, , , ... , , , ... , ... ] inserts elem at several positions.

FilledSmallSquare Examples: Insert[a, b, c, x, 2] LongRightArrow.

FilledSmallSquare Insert[a, b, c, x, 1, -1] LongRightArrow.

FilledSmallSquare Insert[a, b, c, d, x, 2, 1] LongRightArrow.

FilledSmallSquare list can have any head, not necessarily List.

FilledSmallSquare Insert works on SparseArray objects by effectively inserting into the corresponding ordinary lists.

FilledSmallSquare See Section 1.8.6 and Section 2.4.2.

FilledSmallSquare See also: Prepend, Append, StringInsert, Take, Drop, Delete, ReplacePart, FlattenAt, Position, Sequence.

FilledSmallSquare New in Version 1.

Further Examples