Created
March 4, 2014 02:26
-
-
Save jgdavey/9339165 to your computer and use it in GitHub Desktop.
How to get paths for map of sets?
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
(use 'clojure.test) | |
(deftest tracing-paths | |
(testing "trace-paths" | |
(is (= (trace-paths {:a nil} :a) | |
[[:a]])) | |
(is (= (trace-paths {:a #{:b} | |
:b nil} :a) | |
[[:a :b]])) | |
(is (= (trace-paths {:a #{:b :c} | |
:b nil | |
:c #{:b}} :a) | |
[[:a :c :b] [:a :b]])) | |
(is (= (trace-paths {:a #{:b} | |
:b #{:c :d} | |
:c #{:d} | |
:d nil} :a) | |
[[:a :b :c :d] [:a :b :d]])))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
How's this? The
paths
fn is more general: