-
-
Save eightysteele/1572747 to your computer and use it in GitHub Desktop.
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
(import '[java.util UUID]) | |
(defn uuid-stream [] | |
(repeatedly #(str (UUID/randomUUID)))) | |
(defn domain-map [root-path n] | |
(let [name-seq (take n (uuid-stream))] | |
(->> (map (partial str root-path "/") name-seq) | |
(interleave name-seq) | |
(apply hash-map)))) | |
user> (domain-map "/tmp" 3) | |
;; Returns: | |
;; {"04a8c7df-7370-4ed5-82cf-6038d4a59a74" "/tmp/04a8c7df-7370-4ed5-82cf-6038d4a59a74", | |
;; "68443dcf-ae1a-4532-a813-838ed064f24e" "/tmp/68443dcf-ae1a-4532-a813-838ed064f24e", | |
;; "aeed5c8f-a4d3-4638-8d5a-c540281cd474" "/tmp/aeed5c8f-a4d3-4638-8d5a-c540281cd474"} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment