Skip to content

Instantly share code, notes, and snippets.

@aamedina
Created August 7, 2013 14:54
Show Gist options
  • Select an option

  • Save aamedina/6174766 to your computer and use it in GitHub Desktop.

Select an option

Save aamedina/6174766 to your computer and use it in GitHub Desktop.
(defn page!
[init-res req page-size]
(reduce
(fn [coll n]
(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))
(reduced coll)
new-coll)))
(into (sorted-set-by #(compare (:id %1) (:id %2))) init-res)
(range 50)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment