0.8.4-SNAPSHOT Arrow_down_16x16
  • (!=c p)

0 Examples top

Log in to add / edit an example.

See Also top

Log in to add a see also.

Plus_12x12 Minus_12x12 Source clojure/core/logic.clj:2481 top

(defn !=c
  [p]
  (reify
    ITreeConstraint
    clojure.lang.IFn
    (invoke [this a]
      (let [p (loop [sp (seq p) p p]
                (if sp
                  (let [[x v] (first sp)
                        ;; TODO: this seems expensive to walk* both sides
                        ;; and run an equality test there must be a better
                        ;; way - David
                        xv (walk* a x)
                        vv (walk* a v)]
                    (cond
                      (= xv vv) (recur (next sp) (dissoc p x))
                      (nil? (unify a xv vv)) nil
                      :else (recur (next sp) (assoc (dissoc p x) xv vv))))
                  p))]
        (if p
          (when-not (empty? p)
            #_((normalize-store (with-prefix this p)) a)
            ((composeg*
              (remcg this)
              (cgoal (!=c p))) a))
          ((remcg this) a))))
    IPrefix
    (prefix [_] p)
    IWithPrefix
    (with-prefix [_ p] (!=c p))
    IReifiableConstraint
    (reifyc [this v r a]
      (let [p* (-reify a (map (fn [[lhs rhs]] `(~lhs ~rhs)) p) r)]
        (if (empty? p*)
          '()
          `(~'!= ~@p*))))
    IConstraintOp
    (rator [_] `!=)
    (rands [_] (seq (recover-vars p)))
    IRunnable
    (runnable? [this s]
      (some #(not= (walk s %) %) (recover-vars p)))
    IRelevant
    (-relevant? [this s]
      (not (empty? p)))
    IConstraintWatchedStores
    (watched-stores [this] #{::subst})))
Vars in clojure.core.logic/!=c:
Used in 0 other vars

Comments top

No comments for !=c. Log in to add a comment.