This is documentation for Mathematica 8, which was
based on an earlier version of the Wolfram Language.

Flatten

 Flatten[list]flattens out nested lists. Flattenflattens to level n. Flattenflattens subexpressions with head h. Flatten flattens list by combining all levels to make each level i in the result.
• Flatten "unravels" lists, effectively just deleting inner braces.
• Flatten effectively flattens the top level in list n times.
• Flatten flattens out subexpressions with head f.
• If the are matrices, Flatten effectively constructs a single matrix from the "blocks" .
• Flatten effectively transposes levels in list, putting level in list at level k in the result. Note that the function Transpose in effect uses an inverse of this specification.
Flatten out lists at all levels:
Flatten only at level 1:
Flatten out lists at all levels:
 Out[1]=

Flatten only at level 1:
 Out[1]=
 Scope   (5)
No flattening:
Flatten to level 1:
Flatten to level 2:
Flatten to level 3:
Flatten to level 4:
This is the same as using level :
And the same as not specifying a level:
Flatten a sparse array:
Flatten all levels with respect to :
Flatten all levels with respect to :
Here is a matrix:
Flatten an array of blocks with the shape of into a single matrix.
Flatten into a single matrix effectively using the transpose of the blocks:
 Applications   (4)
Join lists and individual elements:
Unravel a matrix:
Make a flattened list of rules:
Do a "transpose" on a ragged array:
Flatten acts as an inverse of Partition:
Flatten effectively arranges elements in the lexicographic order of their indices:
For a permutation p with inverse , Flatten[a, List/@p-1]==Transpose[a, p]:
A random permutation:
Get its inverse:
Peel off successive layers of Framed: