net.reborg.applenews_api.parallel.clj Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of applenews-api Show documentation
Show all versions of applenews-api Show documentation
Java/Clojure client for the Apple News REST api (https://developer.apple.com/go/?id=news-api-ref)
(ns net.reborg.applenews-api.parallel)
(defn ppmap
"Like pmap in std lib with a configurable chunk size."
[f coll n]
(let [rets (map #(future (f %)) coll)
step (fn step [[x & xs :as vs] fs]
(lazy-seq
(if-let [s (seq fs)]
(cons (deref x) (step xs (rest s)))
(map deref vs))))]
(step rets (drop n rets))))
© 2015 - 2025 Weber Informatics LLC | Privacy Policy