Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
7
Task/Run-length-encoding/Clojure/run-length-encoding.clj
Normal file
7
Task/Run-length-encoding/Clojure/run-length-encoding.clj
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
(defn compress [s]
|
||||
(->> (partition-by identity s) (mapcat (juxt count first)) (apply str)))
|
||||
|
||||
(defn extract [s]
|
||||
(->> (re-seq #"(\d+)([A-Z])" s)
|
||||
(mapcat (fn [[_ n ch]] (repeat (Integer/parseInt n) ch)))
|
||||
(apply str)))
|
||||
Loading…
Add table
Add a link
Reference in a new issue