Skip to content

Instantly share code, notes, and snippets.

@aamedina
Created August 7, 2013 16:55
Show Gist options
  • Save aamedina/6175950 to your computer and use it in GitHub Desktop.
Save aamedina/6175950 to your computer and use it in GitHub Desktop.
(defn page!
[init-res req]
(go
(loop [coll (into (sorted-set-by #(compare (:id %1) (:id %2))) init-res)]
(let [req (update-in
req [:query-params]
merge
{:max_id (:id_str (first coll))})
res (<! (async-request req))
new-coll (into coll res)]
(if (= (count new-coll) (count coll))
coll
(recur new-coll))))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment