Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
|
|
@ -0,0 +1,12 @@
|
|||
(defn squeeze [s c]
|
||||
(let [spans (partition-by #(= c %) s)
|
||||
span-out (fn [span]
|
||||
(if (= c (first span))
|
||||
(str c)
|
||||
(apply str span)))]
|
||||
(apply str (map span-out spans))))
|
||||
|
||||
(defn test-squeeze [s c]
|
||||
(let [out (squeeze s c)]
|
||||
(println (format "Input: <<<%s>>> (len %d)\n" s (count s))
|
||||
(format "becomes: <<<%s>>> (len %d)" out (count out)))))
|
||||
Loading…
Add table
Add a link
Reference in a new issue