Skip to content

Instantly share code, notes, and snippets.

@jarppe
Last active August 29, 2015 14:02
Show Gist options
  • Save jarppe/1b1a54d721b06e1a3ad0 to your computer and use it in GitHub Desktop.
Save jarppe/1b1a54d721b06e1a3ad0 to your computer and use it in GitHub Desktop.
lazy-seq of random users from randomuser.me
; start with: lein try clj-http
(require '[clj-http.client :as http])
(defn fetch-random-users [n]
(->> (http/get "http://api.randomuser.me/" {:query-params {:results n} :as :json})
:body
:results
(map :user)))
(defn users []
(lazy-seq (concat (fetch-random-users 5) (users))))
(doseq [user (take 15 (users))]
(println "user:" (:email user)))
@jarppe
Copy link
Author

jarppe commented Jun 23, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment