Mathematica 9 is now available

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.



Any questions about topics on this page? Click here to get an individual response.Buy NowMore Information
THIS IS DOCUMENTATION FOR AN OBSOLETE PRODUCT.
SEE THE DOCUMENTATION CENTER FOR THE LATEST INFORMATION.