Skip to content
Ertuğrul Çetin edited this page Apr 26, 2020 · 2 revisions
(require '[clojure.core.async :refer [chan <!! >!!] :as async])

Pipeline and pipeline-blocking have the same functionality, naming just indicates the performing operation is IO or CPU bound.

(let [c (chan)
      out (chan)]
  (async/onto-chan c (range 10))
  
  ;; or async/pipeline
  (async/pipeline-blocking 5 out (map (fn [x]
                               (Thread/sleep 500)
                               (inc x))) c)

  (<!! (async/into [] out)))
Clone this wiki locally