Hi

I'm new to Clojure so thought that I would work through some basic
examples and decided upon the 99 problems (http://aperiodic.net/phil/
scala/s-99/)

I have got as far as #11. My test for this is

;p11
(deftest encodemodified-should-return-list-with-counts-when-more-than-
one
   (is (= '((3,"a"),"b",(2,"c"),"a") (encodemodified ["a" "a" "a" "b"
"c" "c"
"a"]))))

My initial solution was the following

(defn pack
[col]
   (partition-by identity
col))

(defn encode
[col]
(map #(list (count %) (first
%))
~                              | 20     (pack
col)))
~                              |
21
~                              | 22 (defn encodemodified
[col]
~                              | 23   (map #(if (== (count %) 1)
(first %) (list (count %) (first
%)))
~                              | 24     (pack col)))

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to