Skip to content

Instantly share code, notes, and snippets.

@duncanjbrown
Last active September 12, 2023 22:29
Show Gist options
  • Save duncanjbrown/1ed9abe1a76bdefad9476be5a38d8e81 to your computer and use it in GitHub Desktop.
Save duncanjbrown/1ed9abe1a76bdefad9476be5a38d8e81 to your computer and use it in GitHub Desktop.
(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