funcool

A channel for discussing and asking questions about Funcool libraries https://github.com/funcool/
kenny 2016-10-12T00:00:18.000137Z

Is there a way to get nested observable pushes to evaluate in chronological order rather than their current ordering (by stack frame?). For example, I want @state to be 2, not 1, without changing the order of the code below:

(require '[beicon.core :as rx])
=> nil
(def state (atom 0))
=> #'boot.user/state
(def test-bus (rx/bus))
=> #'boot.user/test-bus
(def sub (rx/subscribe test-bus
                       (fn [f] (f))))
=> #'boot.user/sub
(rx/push! test-bus (fn []
                     (rx/push! test-bus (fn []
                                          (reset! state 2)))
                     (reset! state 1)))
=> nil
@state
=> 1