Wolfram Language & System 10.0 (2014)|Legacy Documentation

This is documentation for an earlier version of the Wolfram Language.View current documentation (Version 11.2)


flattens out nested lists.

flattens to level n.

flattens subexpressions with head h.

flattens list by combining all levels to make each level i in the result.


  • Flatten "unravels" lists, effectively just deleting inner braces.
  • Flatten[list,n] effectively flattens the top level in list n times.
  • Flatten[f[e,]] flattens out subexpressions with head f.
  • If the are matrices, Flatten[{{m11,m12},{m21,m22}},{{1,3},{2,4}}] effectively constructs a single matrix from the "blocks" .
  • Flatten[list,{{i1},{i2},}] 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 flattens out levels in SparseArray objects just as in the corresponding ordinary arrays. »
Introduced in 1988
| Updated in 2007