Skip to content
This repository was archived by the owner on Nov 9, 2017. It is now read-only.
This repository was archived by the owner on Nov 9, 2017. It is now read-only.

Referencing a non-existent reducer should cause an error #64

@emlyn

Description

@emlyn

If you mis-spell the name of a reducer function, it will be ignored silently, e.g.:

(let [fsm (a/compile [:foo :bar (a/$ :baar)]
                     {:reducers {:bar (fn [state _] (assoc state :bar true))}})]
  (reduce (partial a/advance fsm)
          {}
          [:foo :bar]))

I believe it's because of this line in the eval version, and this one in the base version, throwing away any nils after looking up the reducer in the reducers map. Wouldn't it be better to throw some sort of error if a requested reducer does not exist?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions