Last active
September 12, 2023 22:29
-
-
Save duncanjbrown/1ed9abe1a76bdefad9476be5a38d8e81 to your computer and use it in GitHub Desktop.
This file contains hidden or 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)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment