Created
May 9, 2010 08:15
-
-
Save stilkov/395016 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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