Mathematica 9 is now available

Flatten

Usage

Flatten[list]压平嵌套列表。
Flatten[list]压平n层结构。
Flatten[list, n, h]压平有头h的子表达式。


Notes

• 例如: Flatten[ a, b,c , d  ]LongRightArrow .
Flatten 有效的删除内部括号,拆开列表,
Flatten[list, n]有效地压平list中的顶层n次。
Flatten[f[e, ... ]] 压平头为f的子表达式。
• 参见 Mathematica 全书: 1.8.13  2.2.10.
• 同时参见: Partition, FlattenAt.
Further Examples

The second command only flattens out sublists at the first level.

In[1]:=  

Out[1]=

In[2]:=  

Out[2]=

This removes nested occurrences of the function g.

In[3]:=  

Out[3]=

In[4]:=  

Out[4]=

You can use Flatten to splice sequences of elements into lists or other expressions.

In[5]:=  

Out[5]=



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.