Created
December 21, 2011 00:47
-
-
Save timmc/1503998 to your computer and use it in GitHub Desktop.
Multimethod example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns clj.core) | |
(defmulti foo type) | |
(defmethod foo ::common [_] "common") | |
(defmethod foo :default [_] "default") | |
(derive String ::common) | |
(derive Math ::common) | |
(defn -main [& args] | |
(foo "string")) ; => "common" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment