compact method
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:
- RangeExtension.explode for the inverse operation.
Implementation
Iterable<Range<E>> compact({
E Function(E current)? nextValue,
Comparator<E>? compare,
}) =>
_compact(
nextValue: nextValue ?? Scalable.chromaticMotion,
compare: compare ?? Scalable.compareEnharmonically,
);