Last active
July 15, 2016 23:28
-
-
Save xtrntr/2f182765ba1a2b1f7c22179418e69f25 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
(defn point [n n-lst visited-n] | |
(let [res (for [next (map (fn [pair] (= n (first pair))) n-lst) | |
:when (not (some next visited-n))] | |
next)] | |
(println (some list? res)) | |
res)) | |
(defn walk [n1 n2 n-lst] | |
(loop [curr n1 | |
visited '()] | |
(let [next (point curr n-lst visited)] | |
(cond (= curr n2) true | |
(not next) false | |
:else (recur next | |
(cons curr visited)))))) | |
(def test1 '( '(a b) '(b d) '(b c))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment