ruricolist / serapeum

Utilities beyond Alexandria
MIT License
425 stars 42 forks source link

Equivalent of `uniq` #32

Closed ruricolist closed 5 years ago

ruricolist commented 5 years ago

It would be nice to have a utility that does what uniq does on the command line -- eliminate adjacent repetitions. Obviously it would better than remove-duplicates (or nub) for data that is already sorted. But: uniq is a terrible name.

Candidates:

ruricolist commented 5 years ago

Leaning towards collapse-repeats for consistency with collapse-whitespace.

ruricolist commented 5 years ago

Actually there should be two functions: collapse-runs, which takes a one-argument predicate, and collapse-repeats, which takes a two-argument predicate.