Skip to content

Instantly share code, notes, and snippets.

@amalloy
Created April 11, 2011 21:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save amalloy/8ef871f0d800e6e692db to your computer and use it in GitHub Desktop.
Save amalloy/8ef871f0d800e6e692db to your computer and use it in GitHub Desktop.
user> (take-while seq
(map first
(rest
(let [fits? (fn [a b] (>= 4 (Math/abs (- a b))))]
(iterate (fn [[_ [first :as coll]]]
(split-with (partial fits? first) coll))
[nil '(1 2 3 4 5 6 7 7 7 7 7 7 9 10)])))))
((1 2 3 4 5) (6 7 7 7 7 7 7 9 10))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment