Skip to content

Instantly share code, notes, and snippets.

@ddeaguiar
Created October 14, 2012 15:59
Show Gist options
  • Save ddeaguiar/3889008 to your computer and use it in GitHub Desktop.
Save ddeaguiar/3889008 to your computer and use it in GitHub Desktop.
One way to identify neighbors
(ns simple-csp.core
( :refer-clojure :exclude [==])
(:use clojure.core.logic))
(defne arco [x y]
([:sa :wa])
([:sa :nt])
([:sa :q])
([:sa :nsw])
([:sa :v])
([:wa :nt])
([:nt :q])
([:q :nsw])
([:nsw :v])
([:t nil]))
(defn neighborso [x y]
(conde [(arco x y)]
[(arco y x)]))
(run* [q] (neighborso q :wa))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment