Skip to content

Commit

Permalink
no-propagate optimization makes no sense when coupled w/ arithmetic c…
Browse files Browse the repository at this point in the history
…onstraints.

we need to provide a proper fix for distinctfd.
  • Loading branch information
David Nolen authored and David Nolen committed Nov 9, 2012
1 parent 9e36cf9 commit 6e5e805
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions src/main/clojure/clojure/core/logic.clj
Expand Up @@ -2815,11 +2815,10 @@

(defn ext-dom
[a x dom]
(let [no-prop (-> x meta ::no-propagate)
x (root-var a x)
domp (get-dom a x)
a (add-attr a x ::fd dom)]
(if (and (not no-prop) (not= domp dom))
(let [x (root-var a x)
domp (get-dom a x)
a (add-attr a x ::fd dom)]
(if (not= domp dom)
((run-constraints* [x] (:cs a) ::fd) a)
a)))

Expand Down Expand Up @@ -3067,6 +3066,7 @@
(defn sort-by-strategy [v x a]
(case (-> x meta ::strategy)
::ff (seq (sort (sort-by-member-count a) v))
;; TODO: throw on non-existant strategies
v))

;; TODO: handle all Clojure tree types
Expand Down Expand Up @@ -3464,9 +3464,7 @@
s (if-not (lvar? v)
(cond
(= x v) nil
(member? v x) ((process-dom
(assoc-meta y ::no-propagate true)
(difference v x)) s)
(member? v x) ((process-dom y (difference v x)) s)
:else s)
s)]
(when s
Expand Down

0 comments on commit 6e5e805

Please sign in to comment.