Created
December 18, 2015 00:02
-
-
Save devth/6f1ef853d26b75cf7250 to your computer and use it in GitHub Desktop.
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
(defprotocol F | |
(echo [this msg])) | |
(def anon (reify F (echo [this msg] (str msg " anon " this)))) | |
(echo anon "bar") | |
;;=> "bar anon yetibot.core.adapters.adapter$reify__8141@6ebc46fd" | |
(deftype Foo [x y] | |
F | |
(echo [this msg] (str "Foo " msg this x y))) | |
(echo (->Foo 1 3) "hello?") | |
;;=> "Foo hello?yetibot.core.adapters.adapter.Foo@4db20e4c13" | |
(extend-type java.lang.String | |
F | |
(echo [this msg] (str "It's a String `" this "` with message: " msg))) | |
(echo "foo" "bar") | |
;;=> "It's a String `foo` with message: bar" | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment