This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns mutabots | |
"Reimplementation of transducers, in terms of processing functions instead | |
of reducing functions. | |
tl;dr: reducing-fn based transducers are a special case, influenced by reducers, | |
of processing-fn based transducers. | |
In Clojure 1.7.0-alpha2, transducers are expressed in terms of the existing | |
concept of reducing functions. | |
To sum it up, a transducer has currently the signature : |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn queue-process-uncontrolled | |
[input output stats] | |
(async/go | |
(loop [q clojure.lang.PersistentQueue/EMPTY] | |
(let [[val-to-q ch] (async/alts! | |
(if-let [v (peek q)] | |
[input [output v]] | |
[input]))] | |
(swap! stats update-stats-as-you-see-fit q) | |
(cond |