Advertisement
Guest User

Untitled

a guest
Aug 24th, 2011
186
0
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 ??
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement