0.8.4-SNAPSHOT Arrow_down_16x16

fix-constraints

clojure.core.logic

  • (fix-constraints a)
A goal to run the constraints in cq until it is empty. Of
course running a constraint may grow cq so this function
finds the fixpoint.

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:2196 top

(defn fix-constraints
  "A goal to run the constraints in cq until it is empty. Of
   course running a constraint may grow cq so this function
   finds the fixpoint."
  [a]
  (loop [a a]
    (when a
      (let [cq (:cq a)]
        (if (zero? (count cq))
          (assoc a :cq nil)
          (let [c (first cq)]
            (recur
              ((run-constraint c)
               (-> a
                 (assoc :cq (subvec (:cq a) 1))
                 (assoc :cqs (disj (:cqs a) (id c))))))))))))
Vars in clojure.core.logic/fix-constraints:
Used in 0 other vars

Comments top

No comments for fix-constraints. Log in to add a comment.