Guest User

Untitled

a guest
Dec 13th, 2013
178
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. I have copied the code below from the following link - https://gist.github.com/martintrojer/5943467
  2.  
  3. (defn async-get [url result]
  4.   (org.httpkit.client/get url #(go (>! result %))))
  5.  
  6. (time
  7.  (def hk-data
  8.    (let [c (chan)
  9.          res (atom [])]
  10.      ;; fetch em all
  11.      (doseq [i (range 10 100)]
  12.        (async-get (format "http://fssnip.net/%d" i) c))
  13.      ;; gather results
  14.      (doseq [_ (range 10 100)]
  15.        (swap! res conj (<!! c)))
  16.      @res
  17.      )))
Advertisement
Add Comment
Please, Sign In to add comment