Data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 7387c8f97b
commit cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions

View file

@ -0,0 +1,16 @@
(use '[flatland.useful.seq :only (partition-between)])
(defn nonconsecutive? [[x y]]
(not= (inc x) y))
(defn string-ranges [coll]
(let [left (first coll)
size (count coll)]
(cond
(> size 2) (str left "-" (last coll))
(= size 2) (str left "," (last coll))
:else (str left))))
(defn format-with-ranges [coll]
(println (clojure.string/join ","
(map string-ranges (partition-between nonconsecutive? coll)))))