More details on $
Closed this issue · 3 comments
neapel commented
Could you add more details on when the reduce actions are being executed to the documentation, and show the actions in the view
graph?
In the documentation it reads like the actions might be associated with the transitions, but they actually seem to be collected on each state, i.e. for :x :w
input action :F
is still executed because it's associated with state 1, not the transition :z
.
(defn states
[arg]
(let [f (a/compile
[(a/$ :A)
(a/or
[(a/$ :B) :x (a/$ :C)]
[(a/$ :D) :y (a/$ :E) :z (a/$ :F)])
(a/$ :G)
:w
(a/$ :H)]
(apply merge
(map (fn [t] {t #(conj %1 [t %2])})
[:A :B :C :D :E :F :G :H])))])
(:value (a/greedy-find f (a/start f []) arg)))
(states [:x :w])
=> [[:A :x] [:D :x] [:B :x] [:F :x] [:C :x] [:G :x] [:H :w]]
(states [:y :z :w])
=> [[:A :y] [:D :y] [:B :y] [:E :y] [:F :z] [:C :z] [:G :z] [:H :w]]
ztellman commented
I'm actually in the process of making actions associated with inputs rather than states, this was an oversight in my original implementation. A new release with these changes (and labeling of actions in the view
diagrams) will be forthcoming soon.
ztellman commented
neapel commented
Yes, that's great!