Insert
Usage
• Insert[list, elem, n] 在 list中的位置 n插入 elem 。如果n 是负的,位置从结尾计算。
• Insert[expr, elem, i, j, ... ] 在 expr中的位置 i, j, ...  插入 elem。
Notes
• list 可以有任何头,未必是List. • 参见 Mathematica 全书 : 节 1.8.6.
Further Examples
This inserts d into the fourth position of this list.
In[1]:=
|
Out[1]=
|
This inserts b in the first and second positions of this list.
In[2]:=
|
Out[2]=
|
This function builds a random permutation of Range[n] by inserting one element at a time.
In[3]:=
|
In[4]:=
|
Out[4]=
|
This function "sows" copies of the specified object between each pair of entries of expr.
In[5]:=
|
In[6]:=
|
Out[6]=
|
This variant also places copies before the first and after the last elements.
In[7]:=
|
In[8]:=
|
Out[8]=
|
In[9]:=
|
|