The following fns after defmethod are not yet implemented (copied from Clojure JVM):
;(defn remove-all-methods
; "Removes all of the methods of multimethod."
; {:added "1.2"
; :static true}
; [^clojure.lang.MultiFn multifn]
; (.reset multifn))
;
;(defn remove-method
; "Removes the method of multimethod associated with dispatch-value."
; {:added "1.0"
; :static true}
; [^clojure.lang.MultiFn multifn dispatch-val]
; (. multifn removeMethod dispatch-val))
;
;(defn prefer-method
; "Causes the multimethod to prefer matches of dispatch-val-x over dispatch-val-y
; when there is a conflict"
; {:added "1.0"
; :static true}
; [^clojure.lang.MultiFn multifn dispatch-val-x dispatch-val-y]
; (. multifn preferMethod dispatch-val-x dispatch-val-y))
;
;(defn methods
; "Given a multimethod, returns a map of dispatch values -> dispatch fns"
; {:added "1.0"
; :static true}
; [^clojure.lang.MultiFn multifn] (.getMethodTable multifn))
;
;(defn get-method
; "Given a multimethod and a dispatch value, returns the dispatch fn
; that would apply to that value, or nil if none apply and no default"
; {:added "1.0"
; :static true}
; [^clojure.lang.MultiFn multifn dispatch-val] (.getMethod multifn dispatch-val))
;
;(defn prefers
; "Given a multimethod, returns a map of preferred value -> set of other values"
; {:added "1.0"
; :static true}
; [^clojure.lang.MultiFn multifn] (.getPreferTable multifn))
We need to implement them along the same way we have implemented defmethod*. Remove all of the meta maps, since jank doesn't use those for any fns in core right now. Also remove the type hints.
All of this is backed by the multi_function object.
Currently
defmulti
anddefmethod
work. They also support hierarchies. As a demonstration of what works, see these:Factorial
Hierarchies
Compaction
What's missing
The following fns after
defmethod
are not yet implemented (copied from Clojure JVM):We need to implement them along the same way we have implemented
defmethod*
. Remove all of the meta maps, since jank doesn't use those for any fns in core right now. Also remove the type hints.All of this is backed by the
multi_function
object.