Last active
March 15, 2017 03:21
-
-
Save ajchemist/93b5d5e8e40bde79c5a1d60da543910f 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
(ns interface.a) | |
(defprotocol X | |
(x [this])) | |
(ns interface.b) | |
(defprotocol X | |
(x [this])) | |
(ns test.defrecord) | |
(defrecord Example [] | |
interface.a/X | |
(x [_] :a) | |
interface.b/X | |
(x [_] :b)) | |
(interface.a/x (->Example)) ; => :a | |
(interface.b/x (->Example)) ; => :a (not :b) | |
(defrecord Example []) | |
(extend-type Example interface.a/X (x [_] :a) interface.b/X (x [_] :b)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment