Skip to content

Instantly share code, notes, and snippets.

@honzabrecka
Created November 8, 2018 15:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save honzabrecka/fabec28082c698117fc72700cc79dd76 to your computer and use it in GitHub Desktop.
Save honzabrecka/fabec28082c698117fc72700cc79dd76 to your computer and use it in GitHub Desktop.
(defn p-pmap
[max f result xs]
(p/then (->> xs (take max) (map f) p/all)
(fn [resolved]
(let [result (concat result resolved)]
(if (>= (count xs) max)
(p-pmap max f result (drop max xs))
result)))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment