splits list into sublists consisting of runs of identical elements.
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. »
Examplesopen allclose all
Generalizations & Extensions (5)
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:
Split by sign:
Only split when there is a change from negative to positive sign (rising edge):
Only split when there is a change from positive to negative sign (falling edge):
Group equivalence classes according to an equivalence function:
Distribution of lengths of runs of 0s or 1s in the first million bits of :
Distribution of lengths of runs of 0s or 1s in one million pseudorandom bits:
Properties & Relations (1)
Neat Examples (2)
Find runs of numbers in base 10 that contain the same number of 1s:
Iterated run-length encoding [more info]: