Skip to content

Instantly share code, notes, and snippets.

@eightysteele
Forked from sritchie/snippet.clj
Created January 6, 2012 22:36
Show Gist options
  • Save eightysteele/1572747 to your computer and use it in GitHub Desktop.
Save eightysteele/1572747 to your computer and use it in GitHub Desktop.
(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