Fork me on GitHub
#missionary
<
2021-11-27
>
ribelo21:11:15

why does it recalculate 2x?

ribelo21:11:31

(def atm_ (atom {:a 1 :b 1}))
(def r
  (mi/reactor
    (let [>m (mi/signal! (mi/watch atm_))
          >a (mi/signal! (mi/eduction (comp (map :a) (dedupe)) >m))
          >b (mi/signal! (mi/eduction (comp (map :b) (dedupe)) >m))
          >c (mi/latest + >a >b)]
      (mi/stream! (mi/ap (println (mi/?< >c)))))))
(def dispose (r prn prn))
(swap! atm_ (fn [m] (assoc m :a 2 :b 2)))

ribelo21:11:11

I suspect there is a mistake in my reasoning somewhere

leonoel09:11:55

>c (m/signal! (m/latest + >a >b))

ribelo09:11:56

fuck 🙃