Skip to content

Instantly share code, notes, and snippets.

/p.clj Secret

Created October 13, 2016 14:37
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 anonymous/3279a96dc760a63716ba1527ef88065e to your computer and use it in GitHub Desktop.
Save anonymous/3279a96dc760a63716ba1527ef88065e to your computer and use it in GitHub Desktop.
(defprotocol Foo
(bar [this]))
(extend-type clojure.lang.IPersistentMap
Foo
(bar [this]
"I'm a map"))
(extend-type java.lang.String
Foo
(bar [this]
"I'm a string"))
(bar {})
;;=> "I'm a map"
(bar "")
;;=> "I'm a string"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment