This is documentation for Mathematica 6, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.2)

Flatten

Updated In 6 Graphic
Flatten[list]
flattens out nested lists.
Flatten[list, n]
flattens to level n.
Flatten[list, n, h]
flattens subexpressions with head h.
Flatten[list, {{s11, s12, ...}, {s21, s22, ...}, ...}]
flattens list by combining all levels sij 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 mij are matrices, Flatten[{{m11, m12}, {m21, m22}}, {{1, 3}, {2, 4}}] effectively constructs a single matrix from the "blocks" mij.
  • Flatten[list, {{i1}, {i2}, ...}] effectively transposes levels in list, putting level ik in list at level k in the result. Note that the function Transpose in effect uses an inverse of this specification.
New in 1 | Last modified in 6