Last active
August 29, 2015 14:02
-
-
Save jarppe/1b1a54d721b06e1a3ad0 to your computer and use it in GitHub Desktop.
lazy-seq of random users from randomuser.me
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
; 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))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
modified from https://gist.github.com/ikitommi/5a34b1a660550404d8f9