summaryrefslogtreecommitdiff
path: root/src/clj
diff options
context:
space:
mode:
authorRich Hickey <richhickey@gmail.com>2009-04-01 12:39:39 +0000
committerRich Hickey <richhickey@gmail.com>2009-04-01 12:39:39 +0000
commit37606d41d3dcc574dd6b755de4849fe899c01af2 (patch)
tree624e680715644ad36c4b7608bc7934ee4728e575 /src/clj
parent487b713ce0f6fe49470a7f0aa7acf14bdb58c985 (diff)
added get-method
Diffstat (limited to 'src/clj')
-rw-r--r--src/clj/clojure/core.clj5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/clj/clojure/core.clj b/src/clj/clojure/core.clj
index f44fcb71..934dbe89 100644
--- a/src/clj/clojure/core.clj
+++ b/src/clj/clojure/core.clj
@@ -1085,6 +1085,11 @@
"Given a multimethod, returns a map of dispatch values -> dispatch fns"
[#^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"
+ [#^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"
[#^clojure.lang.MultiFn multifn] (.getPreferTable multifn))