Mathematica > Core Language > Expressions > Parts of Expressions > Insert >

Insert

Insert
inserts elem at position n in list. If n is negative, the position is counted from the end.
Insert
inserts elem at position in expr.
Insert
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.
Insert to be at position :
Insert to be at position 2 from the end:
Insert at several positions:
Insert into a 2D array:
Insert to be at position :
In[1]:=
Click for copyable input
Out[1]=
 
Insert to be at position 2 from the end:
In[1]:=
Click for copyable input
Out[1]=
 
Insert at several positions:
In[1]:=
Click for copyable input
Out[1]=
 
Insert into a 2D array:
In[1]:=
Click for copyable input
Out[1]=
Insert into an expression with any head:
Insert at any position in any expression:
Insert into a held expression:
New in 1
Ask a question about this page  |  Suggest an improvement  |  Leave a message for the team
Format:   HTML  |  CDF