Wolfram: List. Add Element
Insert
Insert[list, new, n]-
- Insert an element at index n.
- If n is negative, count from right.
- Return a new list.
Insert[ {3, 4}, x, 2 ] (* {3, x, 4} *) Insert[ {3, 4}, x, -1 ] (* {3, 4, x} *) Insert[list, new, positionSpec]-
- Insert an element at Position positionSpec
Insert[ {3, {4}}, x, {2,1} ] (* {3, {x, 4}} *) Insert[list, new, {pos1, pos2, etc }]-
insert an element at several positions
Insert[ {{1,0}, {2,0}, {3,0}}, x, {{2}, {3,1}} ] (* {{1, 0}, x, {2, 0}, {x, 3, 0}} *)