Advertisement
Guest User

Untitled

a guest
Nov 26th, 2015
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.28 KB | None | 0 0
  1. (fn [coll]
  2. (->> coll
  3. distinct
  4. sort
  5. (reduce
  6. (fn [acc num]
  7. (if (some->> acc last last (- num) #{0 1})
  8. (conj (vec (butlast acc)) (conj (last acc) num))
  9. (conj acc (conj [] num))))
  10. [])
  11. (map (juxt first last))))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement