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

Documentation / Mathematica / Built-in Functions / Lists and Matrices / Structure Manipulation /

Flatten

FilledSmallSquare Flatten[list] flattens out nested lists.

FilledSmallSquare Flatten[list, n] flattens to level n.

FilledSmallSquare Flatten[list, n, h] flattens subexpressions with head h.

FilledSmallSquare Example: Flatten[a,b,c,d] LongRightArrow.

FilledSmallSquare Flatten "unravels" lists, effectively just deleting inner braces.

FilledSmallSquare Flatten[list, n] effectively flattens the top level in list n times.

FilledSmallSquare Flatten[f[e, ... ]] flattens out subexpressions with head f.

FilledSmallSquare Flatten flattens out levels in SparseArray objects just as in the corresponding ordinary arrays.

FilledSmallSquare See Section 1.8.12 and Section 2.2.10.

FilledSmallSquare See also: Partition, FlattenAt.

FilledSmallSquare New in Version 1.

Further Examples