How to | Create Lists

Lists are very important and general structures in the Wolfram Language. They allow you to treat collections of all kinds of objects as a single entity. There are many ways to construct them.

Use the shorthand notation {} to make a list:

Or use List, which automatically is changed to {}:

Use Range with one argument to create a list of integers starting at 1:

Or use Range with two arguments to create a list of integers starting higher:

With three arguments the offset can be different than 1:

This squares each element of the list:

Or use Table to create the first 10 squares:

Just like Range, Table can start higher or jump by any amount:

Use NestList to create a list of the results of applying f to x for 0 through 3 times:

Use Array to create a list of length 4, with elements f[i]:

This gives a 3×2 array:

Use List to create lists of strings:


A matrix in the Wolfram Language is a list of lists.

Use RandomInteger to create a 4×4 matrix of random integers between 0 and 10 (stored as m):

Use MatrixForm to see m as a 2D matrix:


You can apply functions to a list.

You can directly apply math functions to a list:

Math functions keep going deeper:

Some functions give a number as a result:

Length gives the length of a list:

Use Map to apply a function to the elements of a list (not needed for math functions):

This uses Map to apply Length to each sublist:

Similarly, this finds the maximum of each sublist: