Wednesday, January 22, 2014

99 Clojure Problems – 11: Modified Run-length Encoding


(deftest p10-encode-modified
  (is (= '((4 a)  b  (2 c)  (2 a)  d  (4 e)) (encode-modified '( a a a a b c c a a d e e e e)))))


Source. A simple map over the result of P10 leads to the desired result.

Read more about this series.

No comments: