Fork me on GitHub

why not something consuming the channel into an atom or ref?, (swap! v #(-> % pop (conj %2)) el) adds a new value to one end of a PersistentQueue while dropping from the other


I dunno, the idea of using a transducer for that isn't my favorite thing, I like something like:

(def last-30 (java.util.ArrayBlockingQueue. 30))

(def some-chan (a/chan))

(def some-chan-mult (a/mult some-chan))

(def some-chan-1 (a/chan))

(a/tap some-chan-mult some-chan-1)

(async/go-loop []
  (when-let [c (a/<! some-chan-1)]
    (when-not (.offer last-30 c)
      (.take last-30)
      (.offer last-30 c)

(def some-chan-2 (a/chan))

(a/tap some-chan-mult some-chan-2)