Last active
January 4, 2017 09:55
-
-
Save RickMoynihan/0a1ce7ef9b96ff3df2e07607dc8f00a1 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
(def h (atom (make-hierarchy))) | |
(defmulti foo identity :hierarchy h) | |
(defmethod foo :foo [_] :foo) | |
(defmethod foo :bar [_] :bar) | |
(swap! h derive :foo-child :foo) | |
(swap! h derive :bar-child :bar) | |
;; h => #atom[{:parents {:foo-child #{:foo}, :bar-child #{:bar}}, :ancestors {:foo-child #{:foo}, :bar-child #{:bar}}, :descendants {:foo #{:foo-child}, :bar #{:bar-child}}} 0x6221100a] | |
(comment | |
(foo :foo-child) ;; => :foo | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment