This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(def nums (take 100 (repeatedly (partial rand-int 10)))) | |
(->> nums | |
(map-indexed vector) | |
(partition-by second) | |
(map (juxt (comp second first) (partial map first))) | |
(map (fn [[num indexes]] | |
(let [bounds (distinct ((juxt first last) indexes))] | |
(str (clojure.string/join "-" bounds) ": " (apply str (repeat num "#")))))) | |
(run! println)) |
OlderNewer