-
-
Save christianromney/3889040 to your computer and use it in GitHub Desktop.
One way to identify neighbors
This file contains hidden or 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 simple-csp.core) | |
| (def arcs [ | |
| #{:sa :wa} | |
| #{:sa :nt} | |
| #{:sa :q} | |
| #{:sa :nsw} | |
| #{:sa :v} | |
| #{:wa :nt} | |
| #{:nt :q} | |
| #{:q :nsw} | |
| #{:nsw :v} | |
| #{:t nil}]) | |
| (defn neighbors-of [kw] | |
| (remove #(= % kw) (apply concat (filter kw arcs)))) | |
| (neighbors-of :sa) | |
| ; => (:wa :nt :q :nsw :v) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment