Consume HTTP APIs lazily
TL;DR: Using lazy sequences for API consumption has advantages in memory consumption and promotes interactive development.
HTTP APIs are ubiquitous and consuming them is a programming task coming up quite regularly (at least for me). Therefore I found the following idiom pretty useful, which turns a paginated, remote data source (in this case the GitHub jobs API) into a lazy sequence:
(defn- fetch-lazy-jobs-seq! ([] (fetch-lazy-jobs-seq! 0)) ([page] (let [jobs-url (fn [page](format "https://jobs.
[Read More]