Browse files

remove old defrel

  • Loading branch information...
1 parent 335226f commit 1cdb5393aa9b5cac53de76e66d09b2555a1cd002 @orb orb committed with swannodette Oct 7, 2013
View
253 src/main/clojure/clojure/core/logic.clj
@@ -382,7 +382,7 @@
:else (recur vp (find s vp)))))
v))
-
+
(ext-run-cs [this x v]
(let [x (root-var this x)
xs (if (lvar? v)
@@ -492,7 +492,7 @@
(fn [s y] (rem-dom s y dom (conj (or seenset #{}) x)))))))
;; NOTE: I don't think we need to bother returning ::not-dom or some other
-;; not found value. Assume the case where the var is bound to nil in
+;; not found value. Assume the case where the var is bound to nil in
;; the substitution where the var has a domain. That the var is member
;; will be verified by domc or something similar. The case where the var
;; is nil and has no domain is trivial.
@@ -660,7 +660,7 @@
(if (-> u clojure.core/meta ::unbound)
(ext-no-check s u (assoc (root-val s u) :v v))
(ext-no-check s u v)))
-
+
:else nil))
IReifyTerm
@@ -802,7 +802,7 @@
s
(unify s u nil))
nil)))
-
+
(lcons? v)
(loop [u u v v s s]
(if (lvar? u)
@@ -814,7 +814,7 @@
(recur (lnext u) (lnext v) s)
nil)
:else (unify s u v))))
-
+
:else nil))
IReifyTerm
@@ -888,7 +888,7 @@
nil)
nil)
(if-not (nil? v) nil s))))
-
+
(lcons? v) (unify-terms v u s)
:else nil))
@@ -927,7 +927,7 @@
(map? v)
(unify-with-map* u v s)
-
+
:else nil)))
;; =============================================================================
@@ -1174,7 +1174,7 @@
(mapcat lvar-bind syms))
(defmacro fresh
- "Creates fresh variables. Goals occuring within form a logical
+ "Creates fresh variables. Goals occuring within form a logical
conjunction."
[[& lvars] & goals]
`(fn [a#]
@@ -1384,7 +1384,7 @@
(ifa* ~@(map (cond-clauses a) clauses)))))
(defmacro condu
- "Committed choice. Once the head (first goal) of a clause
+ "Committed choice. Once the head (first goal) of a clause
has succeeded, remaining goals of the clause will only
be run once. Non-relational."
[& clauses]
@@ -1475,7 +1475,7 @@
(= f 'quote)
(if (and (seq? s) (not quoted))
(p->term s vars true)
- p)
+ p)
(= f 'clojure.core/unquote)
(if quoted
(update-pvars! s vars)
@@ -1618,7 +1618,7 @@
(== '() a))
(defn conso
- "A relation where l is a collection, such that a is the first of l
+ "A relation where l is a collection, such that a is the first of l
and d is the rest of l. If ground d must be bound to a proper tail."
[a d l]
(== (lcons a d) l))
@@ -1722,16 +1722,16 @@
(defne member1o
"Like membero but uses to disequality further constraining
- the results. For example, if x and l are ground and x occurs
+ the results. For example, if x and l are ground and x occurs
multiple times in l, member1o will succeed only once."
[x l]
([_ [x . tail]])
([_ [head . tail]]
(!= x head)
(member1o x tail)))
-(defne appendo
- "A relation where x, y, and z are proper collections,
+(defne appendo
+ "A relation where x, y, and z are proper collections,
such that z is x appended to y"
[x y z]
([() _ y])
@@ -1758,219 +1758,6 @@
(choice (first aseq)
(fn [] (to-stream (next aseq)))))))
-(defmacro def-arity-exc-helper []
- (try
- (Class/forName "clojure.lang.ArityException")
- `(defn arity-exc-helper [~'name ~'n]
- (fn [~'& ~'args]
- (throw (clojure.lang.ArityException. ~'n (str ~'name)))))
- (catch java.lang.ClassNotFoundException e
- `(defn ~'arity-exc-helper [~'name ~'n]
- (fn [~'& ~'args]
- (throw
- (java.lang.IllegalArgumentException.
- (str "Wrong number of args (" ~'n ") passed to:" ~'name))))))))
-
-(def-arity-exc-helper)
-
-(defn- sym-helper [prefix n]
- (symbol (str prefix n)))
-
-(def f-sym (partial sym-helper "f"))
-(def a-sym (partial sym-helper "a"))
-
-(defn- ->sym [& args]
- (symbol (apply str args)))
-
-(defn- defrel-helper [name arity args]
- (let [r (range 1 (+ arity 2))
- arity-excs (fn [n] `(arity-exc-helper '~name ~n))]
- (if (seq args)
- `(do
- (def ~name
- (.withMeta
- (~'clojure.core.logic.Rel.
- '~name (atom {}) nil ~@(map arity-excs r))
- {:ns ~'*ns*}))
- (extend-rel ~name ~@args))
- `(def ~name
- (.withMeta
- (~'clojure.core.logic.Rel. '~name (atom {}) nil ~@(map arity-excs r))
- {:ns ~'*ns*})))))
-
-(defmacro def-apply-to-helper [n]
- (let [r (range 1 (clojure.core/inc n))
- args (map a-sym r)
- arg-binds (fn [n]
- (mapcat (fn [a]
- `(~a (first ~'arglist)
- ~'arglist (next ~'arglist)))
- (take n args)))
- case-clause (fn [n]
- `(~n (let [~@(arg-binds (dec n))]
- (.invoke ~'ifn ~@(take (dec n) args)
- (clojure.lang.Util/ret1
- (first ~'arglist) nil)))))]
- `(defn ~'apply-to-helper
- [~(with-meta 'ifn {:tag clojure.lang.IFn}) ~'arglist]
- (case (clojure.lang.RT/boundedLength ~'arglist 20)
- ~@(mapcat case-clause r)))))
-
-(def-apply-to-helper 20)
-
-;; TODO: consider moving the set/indexes inside Rel, perf implications?
-
-(defmacro RelHelper [arity]
- (let [r (range 1 (+ arity 2))
- fs (map f-sym r)
- mfs (map #(with-meta % {:volatile-mutable true :tag clojure.lang.IFn})
- fs)
- create-sig (fn [n]
- (let [args (map a-sym (range 1 (clojure.core/inc n)))]
- `(invoke [~'_ ~@args]
- (~(f-sym n) ~@args))))
- set-case (fn [[f arity]]
- `(~arity (set! ~f ~'f)))]
- `(do
- (deftype ~'Rel [~'name ~'indexes ~'meta
- ~@mfs]
- clojure.lang.IObj
- (~'withMeta [~'_ ~'meta]
- (~'Rel. ~'name ~'indexes ~'meta ~@fs))
- (~'meta [~'_]
- ~'meta)
- clojure.lang.IFn
- ~@(map create-sig r)
- (~'applyTo [~'this ~'arglist]
- (~'apply-to-helper ~'this ~'arglist))
- ~'IRel
- (~'setfn [~'_ ~'arity ~'f]
- (case ~'arity
- ~@(mapcat set-case (map vector fs r))))
- (~'indexes-for [~'_ ~'arity]
- ((deref ~'indexes) ~'arity))
- (~'add-indexes [~'_ ~'arity ~'index]
- (swap! ~'indexes assoc ~'arity ~'index)))
- (defmacro ~'defrel
- "Define a relation for adding facts. Takes a name and some fields.
- Use fact/facts to add facts and invoke the relation to query it."
- [~'name ~'& ~'rest]
- (defrel-helper ~'name ~arity ~'rest)))))
-
-(RelHelper 20)
-
-(defn- index-sym [name arity o]
- (->sym name "_" arity "-" o "-index"))
-
-(defn- set-sym [name arity]
- (->sym name "_" arity "-set"))
-
-;; TODO: for arity greater than 20, we need to use rest args
-
-(defn contains-lvar? [x]
- (some lvar? (tree-seq coll? seq x)))
-
-(defmacro extend-rel [name & args]
- (let [arity (count args)
- r (range 1 (clojure.core/inc arity))
- as (map a-sym r)
- indexed (vec (filter (fn [[a i]]
- (-> a meta :index))
- (map vector
- args
- (range 1 (clojure.core/inc arity)))))
- check-lvar (fn [[o i]]
- (let [a (a-sym i)]
- `((not (clojure.core.logic/contains-lvar? (clojure.core.logic/walk* ~'a ~a)))
- ((deref ~(index-sym name arity o)) (clojure.core.logic/walk* ~'a ~a)))))
- indexed-set (fn [[o i]]
- `(def ~(index-sym name arity o) (atom {})))]
- (if (<= arity 20)
- `(do
- (def ~(set-sym name arity) (atom #{}))
- ~@(map indexed-set indexed)
- (add-indexes ~name ~arity '~indexed)
- (setfn ~name ~arity
- (fn [~@as]
- (fn [~'a]
- (let [set# (cond
- ~@(mapcat check-lvar indexed)
- :else (deref ~(set-sym name arity)))]
- (to-stream
- (->> set#
- (map (fn [cand#]
- (when-let [~'a ((== [~@as] cand#) ~'a)]
- ~'a)))))))))))))
-
-;; TODO: Should probably happen in a transaction
-
-(defn facts
- "Define a series of facts. Takes a vector of vectors where each vector
- represents a fact tuple, all with the same number of elements."
- ([rel [f :as tuples]] (facts rel (count f) tuples))
- ([^Rel rel arity tuples]
- (let [rel-ns (:ns (meta rel))
- rel-set (var-get (ns-resolve rel-ns (set-sym (.name rel) arity)))
- tuples (map vec tuples)]
- (swap! rel-set (fn [s] (into s tuples)))
- (let [indexes (indexes-for rel arity)]
- (doseq [[o i] indexes]
- (let [index (var-get (ns-resolve rel-ns (index-sym (.name rel) arity o)))]
- (let [indexed-tuples (map (fn [t]
- {(nth t (dec i)) #{t}})
- tuples)]
- (swap! index
- (fn [i]
- (apply merge-with set/union i indexed-tuples))))))))))
-
-(defn fact
- "Add a fact to a relation defined with defrel."
- [rel & tuple]
- (facts rel [(vec tuple)]))
-
-(defn difference-with
- "Returns a map that consists of the first map with the rest of the maps
- removed from it. When a key is found in the first map and a later map,
- the value from the later map will be combined with the value in the first
- map by calling (f val-in-first val-in-later). If this function returns nil
- then the key will be removed completely."
- [f & maps]
- (when (some identity maps)
- (let [empty-is-nil (fn [s] (if (empty? s) nil s))
- merge-entry (fn [m [k v]]
- (if (contains? m k)
- (if-let [nv (empty-is-nil (f (get m k) v))]
- (assoc m k nv)
- (dissoc m k))
- m))
- merge-map (fn [m1 m2] (reduce merge-entry (or m1 {}) (seq m2)))]
- (reduce merge-map maps))))
-
-(defn retractions
- "Retract a series of facts. Takes a vector of vectors where each vector
- represents a fact tuple, all with the same number of elements. It is not
- an error to retract a fact that isn't true."
- ([rel [f :as tuples]]
- (when f (retractions rel (count f) tuples)))
- ([^Rel rel arity tuples]
- (let [rel-ns (:ns (meta rel))
- rel-set (var-get (ns-resolve rel-ns (set-sym (.name rel) arity)))
- tuples (map vec tuples)]
- (swap! rel-set (fn [s] (reduce disj s tuples)))
- (let [indexes (indexes-for rel arity)]
- (doseq [[o i] indexes]
- (let [index (var-get (ns-resolve rel-ns (index-sym (.name rel) arity o)))]
- (let [indexed-tuples (map (fn [t]
- {(nth t (dec i)) #{t}})
- tuples)]
- (swap! index
- (fn [i]
- (apply difference-with set/difference i indexed-tuples))))))))))
-
-(defn retraction
- "Remove a fact from a relation defined with defrel."
- [rel & tuple]
- (retractions rel [(vec tuple)]))
;; =============================================================================
;; Tabling
@@ -2036,7 +1823,7 @@
(defn waiting-stream-check
"Take a waiting stream, a success continuation, and a failure continuation.
- If we don't find any ready suspended streams, invoke the failure continuation.
+ If we don't find any ready suspended streams, invoke the failure continuation.
If we find a ready suspended stream calculate the remainder of the waiting
stream. If we've reached the fixpoint just call the thunk of the suspended
stream, otherwise call mplus on the result of the thunk and the remainder
@@ -2169,7 +1956,7 @@
;; TODO: consider the concurrency implications much more closely
(defmacro tabled
- "Macro for defining a tabled goal. Prefer ^:tabled with the
+ "Macro for defining a tabled goal. Prefer ^:tabled with the
defne/a/u forms over using this directly."
[args & grest]
(let [uuid (symbol (str "tabled-" (UUID/randomUUID)))]
@@ -2513,7 +2300,7 @@
(when-not (= vf ::not-found)
(if-let [cs (disunify s (get u kf) vf cs)]
(recur (next ks) cs)
- nil)))
+ nil)))
cs))
nil)))
@@ -2711,8 +2498,8 @@
(defn featurec
"Ensure that a map contains at least the key-value pairs
- in the map fs. fs must be partially instantiated - that is,
- it may contain values which are logic variables to support
+ in the map fs. fs must be partially instantiated - that is,
+ it may contain values which are logic variables to support
feature extraction."
[x fs]
(cgoal (-featurec x (partial-map fs))))
@@ -2875,7 +2662,7 @@
(fc t s)
(when-let [s (fc (lfirst t) s)]
(recur (lnext t) s)))))
-
+
clojure.lang.Sequential
(-constrain-tree [t fc s]
(loop [t (seq t) s s]
View
83 src/main/clojure/clojure/core/logic/bench.clj
@@ -3,6 +3,7 @@
(:use [clojure.core.logic :as l])
(:require [clojure.core.logic.arithmetic :as a]
[clojure.core.logic.fd :as fd]
+ [clojure.core.logic.pldb :as pldb]
[clojure.repl :as r]
[clojure.pprint :as pp]
[clojure.set :as set]))
@@ -93,7 +94,7 @@
(comment
(run 1 [q] (zebrao q))
-
+
;; SWI-Prolog 6-8.5s
;; now 2.5-2.6s, old days <2.4s
(dotimes [_ 5]
@@ -111,13 +112,16 @@
;; =============================================================================
;; cliques
-(defrel connected ^:index x ^:index y)
-(facts connected [[1 2] [1 5]])
-(facts connected [[2 1] [2 3] [2 5]])
-(facts connected [[3 2] [3 4]])
-(facts connected [[4 3] [4 5] [4 6]])
-(facts connected [[5 1] [5 2] [5 4]])
-(facts connected [[6 4]])
+(pldb/db-rel connected ^:index x ^:index y)
+
+(def connected-db
+ (pldb/db
+ [connected [[1 2] [1 5]]]
+ [connected [[2 1] [2 3] [2 5]]]
+ [connected [[3 2] [3 4]]]
+ [connected [[4 3] [4 5] [4 6]]]
+ [connected [[5 1] [5 2] [5 4]]]
+ [connected [[6 4]]]))
(defne connected-to-allo
"Ensure that vertex v is connected to all vertices
@@ -141,19 +145,20 @@
(run-nc* [q]
(fresh [a b d]
(== q (llist a b d))
- (bounded-listo q 6)
+ (fd/bounded-listo q 6)
(all-connected-to-allo q)))
-
+
;; 350-400ms
(dotimes [_ 5]
(time
(dotimes [_ 100]
(doall
- (run-nc 20 [q]
- (fresh [a b d]
- (== q (llist a b d))
- (bounded-listo q 6)
- (all-connected-to-allo q)))))))
+ (pldb/with-db connected-db
+ (run-nc 20 [q]
+ (fresh [a b d]
+ (== q (llist a b d))
+ (fd/bounded-listo q 6)
+ (all-connected-to-allo q))))))))
)
;; =============================================================================
@@ -224,7 +229,7 @@
;; direct translation does not work
;; because of the subtraction constraints
;; also, some domain inference would be nice
-
+
(defne noattackfd [y ys d]
([_ () _])
([y1 [y2 . yr] d]
@@ -346,13 +351,13 @@
;; ~1050ms, a little bit slower w/ distribute step
(dotimes [_ 5]
(time
- (dotimes [_ 100]
+ (dotimes [_ 100]
(doall (cryptarithfd-1)))))
;; 3X slower still
(dotimes [_ 5]
(time
- (dotimes [_ 10]
+ (dotimes [_ 10]
(doall (cryptarithfd-1)))))
;; WORKS: takes a long time ([5 2 6 4 8 1 9 7 3 0])
@@ -415,7 +420,7 @@
(everyg #(fd/in % (fd/interval 1 5)) vs)
(fd/!= baker 5) (fd/!= cooper 1)
(fd/!= fletcher 5) (fd/!= fletcher 1)
- (fd/< cooper miller)
+ (fd/< cooper miller)
(not-adjacento smith fletcher)
(not-adjacento fletcher cooper)))
@@ -470,9 +475,9 @@
;; 620ms
(dotimes [_ 10]
(time
- (dotimes [_ 1e3]
+ (dotimes [_ 1e3]
(doall (simple-fd-eq)))))
-
+
(run* [q]
(fresh [a b]
(fd/* a 3 34)
@@ -529,7 +534,7 @@
(defn matches [n]
(run 1 [a b c d]
- (fd/in a b c d (fd/interval 1 n))
+ (fd/in a b c d (fd/interval 1 n))
(fd/distinct [a b c d])
(== a 1)
(fd/<= a b) (fd/<= b c) (fd/<= c d)
@@ -588,7 +593,7 @@
;; 1.9s
(dotimes [_ 10]
(time
- (dotimes [_ 1e3]
+ (dotimes [_ 1e3]
(doall (small-sudokufd)))))
(small-sudokufd)
@@ -624,7 +629,7 @@
(get-square rows x y)))
(defn sudokufd [hints]
- (let [vars (repeatedly 81 lvar)
+ (let [vars (repeatedly 81 lvar)
rows (->rows vars)
cols (->cols rows)
sqs (->squares rows)]
@@ -693,10 +698,10 @@
3 0 1 0 0 7 0 4 0
7 2 0 0 4 0 0 6 0
0 0 4 0 1 0 0 0 3])
-
+
(sudokufd easy0)
(time (doall (sudokufd easy0)))
-
+
(sudokufd easy1)
(time (sudokufd easy1))
@@ -749,7 +754,7 @@
0 0 0 0 9 0 2 0 0
0 0 8 0 7 0 4 0 0
0 0 3 0 6 0 0 0 0
-
+
0 1 0 0 0 2 8 9 0
0 4 0 0 0 0 0 0 0
0 5 0 1 0 0 0 0 0])
@@ -797,7 +802,7 @@
9 0 0 0 0 4 0 7 0
0 0 0 6 0 8 0 0 0
0 1 0 2 0 0 0 0 3
-
+
8 2 0 5 0 0 0 0 0
0 0 0 0 0 0 0 0 5
0 3 4 0 9 0 7 1 0])
@@ -810,16 +815,16 @@
(doall (sudokufd ciao)))))
(def jacop
- [0 1 0 4 2 0 0 0 5
- 0 0 2 0 7 1 0 3 9
- 0 0 0 0 0 0 0 4 0
-
- 2 0 7 1 0 0 0 0 6
- 0 0 0 0 4 0 0 0 0
- 6 0 0 0 0 7 4 0 3
-
- 0 7 0 0 0 0 0 0 0
- 1 2 0 7 3 0 5 0 0
+ [0 1 0 4 2 0 0 0 5
+ 0 0 2 0 7 1 0 3 9
+ 0 0 0 0 0 0 0 4 0
+
+ 2 0 7 1 0 0 0 0 6
+ 0 0 0 0 4 0 0 0 0
+ 6 0 0 0 0 7 4 0 3
+
+ 0 7 0 0 0 0 0 0 0
+ 1 2 0 7 3 0 5 0 0
3 0 0 0 8 2 0 7 0])
;; 400ms
@@ -863,7 +868,7 @@
;; ~2300ms
(dotimes [_ 5]
(time
- (dotimes [_ 100]
+ (dotimes [_ 100]
(doall (safefd)))))
)
View
6 src/main/clojure/clojure/core/logic/pldb.clj
@@ -31,8 +31,12 @@
(defn indexed? [v]
(true? (:index (meta v))))
+
+(defn contains-lvar? [x]
+ (some l/lvar? (tree-seq coll? seq x)))
+
(defn ground? [s term]
- (not (l/contains-lvar? (l/walk* s term))))
+ (not (contains-lvar? (l/walk* s term))))
(defn index-for-query [s q indexes]
(let [indexable (map #(ground? s %) q)
View
94 src/test/clojure/clojure/core/logic/tests.clj
@@ -709,7 +709,7 @@
(fresh []
(conde
[f2 (conde
- [f2]
+ [f2]
[(== false false)])]
[(== false false)])))
@@ -1094,80 +1094,6 @@
(= r #{2 3 4 5})))))
;; -----------------------------------------------------------------------------
-;; rel
-
-(defrel man p)
-
-(fact man 'Bob)
-(fact man 'John)
-(fact man 'Ricky)
-
-(defrel woman p)
-(fact woman 'Mary)
-(fact woman 'Martha)
-(fact woman 'Lucy)
-
-(defrel likes p1 p2)
-(fact likes 'Bob 'Mary)
-(fact likes 'John 'Martha)
-(fact likes 'Ricky 'Lucy)
-
-(defrel fun p)
-(fact fun 'Lucy)
-
-(deftest test-rel-1
- (is (= (run* [q]
- (fresh [x y]
- (likes x y)
- (fun y)
- (== q [x y])))
- '([Ricky Lucy]))))
-
-(retraction likes 'Bob 'Mary)
-
-(deftest test-rel-retract
- (is (= (into #{}
- (run* [q]
- (fresh [x y]
- (likes x y)
- (== q [x y]))))
- (into #{} '([John Martha] [Ricky Lucy])))))
-
-(defrel rel1 ^:index a)
-(fact rel1 [1 2])
-
-(deftest test-rel-logic-29
- (is (= (run* [q]
- (fresh [a]
- (rel1 [q a])
- (== a 2)))
- '(1))))
-
-(defrel rel2 ^:index e ^:index a ^:index v)
-
-(facts rel2 [[:e1 :a1 :v1]
- [:e1 :a2 :v2]])
-
-(retractions rel2 [[:e1 :a1 :v1]
- [:e1 :a1 :v1]
- [:e1 :a2 :v2]])
-
-(deftest rel2-dup-retractions
- (is (= (run* [out]
- (fresh [e a v]
- (rel2 e :a1 :v1)
- (rel2 e a v)
- (== [e a v] out)))
- '())))
-
-(deftest test-to-stream
- ;; LOGIC-139
- (let [answers
- (run* [q] (fresh [x] (!= x 'Bob) (man x)))]
- (is (= 2 (count answers)))
- (is (every? symbol? answers))))
-
-;; -----------------------------------------------------------------------------
;; nil in collection
(deftest test-nil-in-coll-1
@@ -1310,7 +1236,7 @@
(deftest test-unifier-as-1
(is (= (u/unify {:as '{?x (?y ?z)}} ['?x '(1 2)])))
(is (= (u/unify {:as '{?x (?y ?z)}} ['(?x) '((1 2))])))
- (is (= (u/unify {:as '{?x (?y ?y)}} '[[?y ?x] [1 (1 1)]])
+ (is (= (u/unify {:as '{?x (?y ?y)}} '[[?y ?x] [1 (1 1)]])
'[1 (1 1)])))
;;Anonymous constraints
@@ -1440,7 +1366,7 @@
;; -----------------------------------------------------------------------------
;; Pattern matching functions preserve metadata
-(defne ^:tabled dummy
+(defne ^:tabled dummy
"Docstring"
[x l]
([_ [x . tail]])
@@ -1613,7 +1539,7 @@
(deftest test-111-conda-regression
(is (= (run* [x]
- (conda
+ (conda
[succeed
(project [x] succeed)
(project [x] succeed)]))
@@ -1640,7 +1566,7 @@
(project [goals]
;;when there are no more goals we are done
(conde [(== true
- (empty? goals))
+ (empty? goals))
(== curr end)]
;;there are still goals left
;;solve the first and recursive call
@@ -2104,7 +2030,7 @@
(is (= (fd/-intersection mi0 7) 7))
(is (= (fd/-intersection 7 mi0) 7))))
-;; |-----|
+;; |-----|
;; |-----|
(deftest test-intersection-mimi-3
(let [mi0 (fd/multi-interval (fd/interval 1 4) (fd/interval 7 10))]
@@ -2162,7 +2088,7 @@
(fd/multi-interval (fd/interval 1 4) (fd/interval 6 8))))))
;; |---| |---|
-;; N
+;; N
(deftest test-difference-mis-1
(let [mi0 (fd/multi-interval (fd/interval 1 4) (fd/interval 7 10))]
(is (= (fd/-difference mi0 8)
@@ -3058,7 +2984,7 @@
(everyg #(fd/in % (fd/interval 1 5)) vs)
(fd/!= baker 5) (fd/!= cooper 1)
(fd/!= fletcher 5) (fd/!= fletcher 1)
- (fd/< cooper miller)
+ (fd/< cooper miller)
(not-adjacento smith fletcher)
(not-adjacento fletcher cooper)))
@@ -3090,7 +3016,7 @@
(defn matches [n]
(run 1 [a b c d]
- (fd/in a b c d (fd/interval 1 n))
+ (fd/in a b c d (fd/interval 1 n))
(fd/distinct [a b c d])
(== a 1)
(fd/<= a b) (fd/<= b c) (fd/<= c d)
@@ -3127,7 +3053,7 @@
(get-square rows x y)))
(defn sudokufd [hints]
- (let [vars (repeatedly 81 lvar)
+ (let [vars (repeatedly 81 lvar)
rows (->rows vars)
cols (->cols rows)
sqs (->squares rows)]

0 comments on commit 1cdb539

Please sign in to comment.