0.8.4-SNAPSHOT Arrow_down_16x16
  • (unifier* ts)
  • (unifier* opts ts)
Return the unifier that unifies terms ts.
All terms in ts should prepped terms.

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/unifier.clj:119 top

(defn unifier*
  "Return the unifier that unifies terms ts.
  All terms in ts should prepped terms."
  ([ts] (unifier* {} ts))
  ([opts ts]
     (letfn [(-unifier* [s u w]
               (let [s (fix-constraints (l/unify (with-meta s {:reify-vars false}) u w))]
                 (when s
                   (->> (:lvars opts)
                     (map (fn [sym] [sym (lvar sym false)]))
                     (filter (fn [[sym var]] (not= (walk s var) var)))   
                     (map (fn [[sym var]] [sym (-reify s var)]))
                     (into {})))))]
       (let [init-s (init-s opts empty-s)]
         (reduce #(-unifier* init-s %1 %2) ts)))))
Vars in clojure.core.logic.unifier/unifier*:
Used in 0 other vars

Comments top

No comments for unifier*. Log in to add a comment.