pub fn contiguous_runs<T>(sorted: &[T]) -> Vec<Range<usize>>Expand description
The runs of sorted values each one more than the one before, as ranges
of their positions: what music21’s groupContiguousIntegers groups.
use music21::common::numbertools::contiguous_runs;
assert_eq!(contiguous_runs(&[3, 4, 6, 7, 20]), [0..2, 2..4, 4..5]);