Mathematica 9 is now available
THIS IS DOCUMENTATION FOR AN OBSOLETE PRODUCT.
SEE THE DOCUMENTATION CENTER FOR THE LATEST INFORMATION.
Mathematica > Core Language > List Manipulation > Rearranging & Restructuring Lists >
Mathematica > Data Manipulation > Handling Arrays of Data > Rearranging & Restructuring Lists >

Split

Split[list]
splits list into sublists consisting of runs of identical elements.
Split[list, test]
treats pairs of adjacent elements as identical whenever applying the function test to them yields True.
  • The default function used to test whether elements are identical is SameQ.
  • Split can be used to perform run-length encoding.  »
Split in increasing runs of elements:
Decreasing runs of elements:
Split based on first elements:
Split at jumps:
Split so that in each sublist successive elements are not the same:
Split after every occurrence of a:
Split before every occurrence of a:
Group together identical elements:
Run-length encoding:
Group equivalence classes according to an equivalence function:
Distribution of lengths of runs of 0s or 1s in the first million bits of Pi:
Distribution of lengths of runs of 0s or 1s in one million pseudorandom bits:
Flatten acts an inverse of Split:
Find runs of numbers in base 10 that contain the same number of 1s:
Iterated run-length encoding [more info]:
New in 3
Ask a question about this page  |  Suggest an improvement  |  Leave a message for the team