Skip to content

Instantly share code, notes, and snippets.

@sritchie
Created January 6, 2012 20:00
Show Gist options
  • Save sritchie/1572151 to your computer and use it in GitHub Desktop.
Save sritchie/1572151 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 name-seq]
(->> (uuid-stream)
(map (partial str root-path "/"))
(interleave name-seq)
(apply hash-map)))
user> (domain-map "/tmp" ["domain-a" "domain-b" "domain-c"])
;; Returns:
;; {"domain-a" "/tmp/26f8fcfd-5bf0-4f15-891c-a28c9d63363c"
;; "domain-b" "/tmp/172c6397-3e5b-4164-940e-a9f3af039812"
;; "domain-c" "/tmp/25a500fb-a658-4743-b06c-a0b3935f0815"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment