This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-05-22
Channels
- # architecture (1)
- # aws (3)
- # beginners (78)
- # boot (33)
- # cider (49)
- # cljs-dev (3)
- # clojure (82)
- # clojure-berlin (2)
- # clojure-dusseldorf (14)
- # clojure-gamedev (75)
- # clojure-italy (15)
- # clojure-nl (2)
- # clojure-poland (9)
- # clojure-russia (1)
- # clojure-spec (11)
- # clojure-uk (91)
- # clojurescript (17)
- # core-async (2)
- # cursive (1)
- # data-science (3)
- # datascript (34)
- # datomic (13)
- # docs (2)
- # duct (32)
- # emacs (8)
- # fulcro (95)
- # instaparse (17)
- # jobs (2)
- # jobs-discuss (1)
- # jobs-rus (4)
- # leiningen (1)
- # luminus (1)
- # lumo (4)
- # mount (1)
- # nrepl (1)
- # off-topic (98)
- # onyx (13)
- # portkey (12)
- # re-frame (10)
- # reagent (11)
- # remote-jobs (4)
- # rum (3)
- # shadow-cljs (34)
- # specter (7)
- # sql (1)
- # tools-deps (8)
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)
(recur))))
(def some-chan-2 (a/chan))
(a/tap some-chan-mult some-chan-2)