Skip to content

Instantly share code, notes, and snippets.

@timmc
Created December 21, 2011 00:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save timmc/1503998 to your computer and use it in GitHub Desktop.
Save timmc/1503998 to your computer and use it in GitHub Desktop.
Multimethod example
(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