Michael Drogalis shows a very concise pipeline

(written by lawrence krubner, however indented passages are often quotes). You can contact lawrence at: lawrence@krubner.com, or follow me on Twitter.

Michael Drogalis has another one of those posts from which I learn a lot. In this case I am impressed that he manages to get the abstract concept of a pipeline down to the minimum of code:

(defn pipeline []
(let [bound 10000
m-ch (chan bound)
n-ch (chan bound)
o-ch (chan bound)]
(go (while true (put! n-ch (m (<! m-ch)))))
(go (while true (put! o-ch (n (<! n-ch)))))
(go (while true (o (<! o-ch))))

One thing I struggled with was trying to figure out how to run this at the REPL in Emacs. I had to add core.async to project.clj and download as a dependency. (I suddenly realize: this is why people use Pomegranate, to make it easier to experiment at the REPL?)

Post external references

  1. 1