Initial data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 72d218235f
commit f23f22d71c
199087 changed files with 3378941 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)))))