Mathematica 9 is now available

Insert

Usage

Insert[list, elem, n]list中的位置 n插入 elem 。如果n 是负的,位置从结尾计算。
Insert[expr, elem,  i, j, ...  ]expr中的位置  i, j, ...  插入elem
Insert[expr, elem,    ,  , ...  ,   ,  , ...  , ...  ]在几个位置插入elem


Notes

• 例: Insert[ a, b, c , x, 2]LongRightArrow .
Insert[ a, b, c , x,   1 ,  -1  ]LongRightArrow .
Insert[  a, b ,  c, d  , x,  2, 1 ]LongRightArrow .
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]:=  



Any questions about topics on this page? Click here to get an individual response.Buy NowMore Information
THIS IS DOCUMENTATION FOR AN OBSOLETE PRODUCT.
SEE THE DOCUMENTATION CENTER FOR THE LATEST INFORMATION.