SHARE
TWEET

Untitled

a guest Aug 24th, 2011 131 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ;; This works
  2.  
  3. (defn subscribe* [http-url path query-map f]
  4.   (with-open [client (client/create-client)]
  5.     (let [response (stream-seq client http-url path query-map)]
  6.       (doseq [content (client/string response)]
  7.         (doseq [line (re-seq #".+\r\n" content)]
  8.           (let [record (json/read-json line)]
  9.             (f record)))))))
  10.  
  11. ;; But has to be called like this:
  12.  
  13. (subscribe rexx yy zz #(println %))
  14.  
  15. ;; Want to be able to get a seq back instead:
  16.  
  17. (doseq [s (subscribe-seq xx yy zz)]
  18.    (println s))
  19.  
  20. ;; How can I fold in the multiple lazy-seq's into a single (subscribe-seq ??
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top