Thanks to IMultiFn
in CLJS types and records can be easily extended to behave as multimethods. For example:
`
(defrecord MyMulti
[add-method remove-method dispatch-fn method-table]
IMultiFn
(-add-method [_ dispatch-val f]
(add-method dispatch-val f))
(-remove-method [_ dispatch-val]
(remove-method dispatch-val))
(-methods [_] @method-table))
(def my-multi (->MyMulti ...))
(defmethod my-multi :foo
[x]
...)
`
In Clojure however this isn't as easy because multimethods are not implemented using protocols. IS there ANY way to make a record or type to work with defmethod in CLJ?
Thanks!