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 / The Mathematica Book / A Practical Introduction to Mathematica / Lists /

1.8.12 Advanced Topic: Rearranging Nested Lists

You will encounter nested lists if you use matrices or generate multidimensional arrays and tables. Mathematica provides many functions for handling such lists.

A few functions for rearranging nested lists.

This "flattens out" sublists. You can think of it as effectively just removing all inner braces.

In[1]:= Flatten[{{a}, {b, {c}}, {d}}]

Out[1]=

This flattens out only one level of sublists.

In[2]:= Flatten[{{a}, {b, {c}}, {d}}, 1]

Out[2]=

There are many other operations you can perform on nested lists. We will discuss more of them in Section 2.4.