compact method

Iterable<Range<E>> compact({
  1. E nextValue(
    1. E current
    )?,
  2. Comparator<E>? compare,
})

Compacts this Iterable into a list of Ranges based on nextValue and compare.

Example:

[Note.c, Note.d.flat, Note.d, Note.e.flat, Note.g].compact().toList() == [
  (from: Note.c, to: Note.e),
  (from: Note.g, to: Note.a.flat),
]

See also:

Implementation

Iterable<Range<E>> compact({
  E Function(E current)? nextValue,
  Comparator<E>? compare,
}) =>
    _compact(
      nextValue: nextValue ?? Scalable.chromaticMotion,
      compare: compare ?? Scalable.compareEnharmonically,
    );