Skip to content

Instantly share code, notes, and snippets.

@stilkov
Created May 9, 2010 08:15
Show Gist options
  • Save stilkov/395016 to your computer and use it in GitHub Desktop.
Save stilkov/395016 to your computer and use it in GitHub Desktop.
(defn compress [l]
(let [sum-up (fn [l e]
(if (= (last (drop-last l)) e)
(conj (vec (drop-last l)) (inc (last l)))
(conj l e 1)))]
(reduce sum-up [] l)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment