Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (fn [coll]
- (->> coll
- distinct
- sort
- (reduce
- (fn [acc num]
- (if (some->> acc last last (- num) #{0 1})
- (conj (vec (butlast acc)) (conj (last acc) num))
- (conj acc (conj [] num))))
- [])
- (map (juxt first last))))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement