Skip to content

Instantly share code, notes, and snippets.

@ikitommi
Created June 4, 2014 16:59
Show Gist options
  • Save ikitommi/5a34b1a660550404d8f9 to your computer and use it in GitHub Desktop.
Save ikitommi/5a34b1a660550404d8f9 to your computer and use it in GitHub Desktop.
Random names with clojure
lein try clj-http
; nREPL server started on port 64184 on host 127.0.0.1
; REPL-y 0.3.0
;Clojure 1.5.1
; Tommi's awesome REPL
(require '[clj-http.client :as client])
(defn random-names [n]
(->> (client/get "http://api.randomuser.me/" {:query-params {:results n :seed "kikkakakkakukka"} :as :json})
:body
:results
(map :user)
(map :name)
(map (fn [{:keys [first last]}] (str first " " last)))))
; 'user/random-names
(random-names 1)
; ("herbert garza")
(random-names 20)
; ("herbert garza" "georgia gibson" "dave chavez" "stella ramirez" "nelson bryant" "jennie burton" "bobby chambers" "russell mason" "shelly sullivan" "rose carlson" "julie harvey" "lucas jensen" "rose andrews" "chloe graves" "misty burns" "roland welch" "rosa patterson" "bill bryant" "darren kennedy" "ramon barrett")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment