List Manipulation

Lists are central constructs in the Wolfram Language, used to represent collections, arrays, sets, and sequences of all kinds. Lists can have any structure and size and can routinely involve even millions of elements. Well over a thousand built-in functions throughout the Wolfram Language operate directly on lists, making lists a powerful vehicle for interoperability.

Constructing Lists »

{a,b,} (List) specify a list explicitly

Table make a table of values of an expression

Array make an array of any dimension from a function

Range  ▪  Subdivide  ▪  SparseArray  ▪  NumericArray  ▪  Tuples  ▪  NestList  ▪  ...

Elements of Lists »

list[[]] parts or sequences of parts (;;), resettable with =

First  ▪  Last  ▪  Take  ▪  Drop  ▪  TakeList  ▪  Extract  ▪  Append  ▪  ReplacePart  ▪  ...

Select select according to a function

Cases give cases matching a pattern

Length  ▪  Position  ▪  MemberQ  ▪  DeleteDuplicates  ▪  ...

Nothing an element automatically removed from lists

Splice sequence of elements to automatically be spliced into a list

Rearranging & Restructuring Lists »

Flatten flatten out nested lists

Join  ▪  Partition  ▪  Transpose  ▪  Reverse  ▪  Sort  ▪  Split  ▪  Gather  ▪  Riffle  ▪  ...

Applying Functions to Lists »

Map (/@) map a function over a list: f/@{a,b,c}{f[a],f[b],f[c]}

Apply (@@) apply to a list: f@@{x,y,z}f[x,y,z]

MapApply (@@@) apply to a list: f@@@{x,y,z}{f@@x,f@@y,f@@z}

MapIndexed  ▪  Scan  ▪  Thread  ▪  MapThread  ▪  Outer  ▪  FoldList  ▪  ...

Threaded thread listable functions at the deepest levels of array arguments

Predicates on Lists

AllTrue  ▪  AnyTrue  ▪  NoneTrue

ContainsAll  ▪  ContainsNone  ▪  ContainsAny  ▪  ContainsOnly  ▪  ContainsExactly

Math & Counting Operations »

{}+{}, etc. automatically operate in parallel on list elements

Total  ▪  Differences  ▪  Count  ▪  CountDistinct  ▪  Counts  ▪  BinCounts  ▪  SequenceCount  ▪  ...

Displaying & Visualizing Lists »

Column  ▪  Row  ▪  Grid  ▪  ListPlot  ▪  ArrayPlot  ▪  ...

Importing & Exporting Lists »

Import  ▪  Export  ▪  "Table"  ▪  "Text"  ▪  "CSV"  ▪  ...

Creating Associations from Lists »

Counts  ▪  GroupBy  ▪  PositionIndex  ▪  ...