ztellman/automat

Inconsistency of $

dryewo opened this issue · 1 comments

First of all, thanks for the wonderful library! I'm trying to study FSM applications and doing some exercises. Suddenly I bumped into an issue:

This works:

(view  (a/interpose-$ 42 [1]))

While this doesn't:

(view [1 (a/$ 42)])

If I replace 42 with :foo, it works both ways and produces identical FSMs.
My use case is that I want to dispatch reducers with a function, not with a map:

(defn reducers [v]
  (fn [state _] (+ state v)))
...
(a/compile [ ... ]
             {:reducers reducers}))

Therefore I need to pass more than just a keyword, possibly a nested data structure.
Is this a bug or a feature? It would be great to have it working consistently, and also just $ is much shorter than interpose-$.

It was an unspoken assumptions that the reducer functions would only be defined using keywords. I need to look over the code to see if there's any reason it can't be something else, but I'm pretty sure it's possible with minor changes. Thanks for the report.