0.8.4-SNAPSHOT Arrow_down_16x16

merge-with-root

clojure.core.logic

  • (merge-with-root s x root)

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

(defn merge-with-root [s x root]
  (let [xv    (root-val s x)
        rootv (root-val s root)
        eset  (set/union (:eset rootv) (:eset xv))
        doms (loop [xd (seq (:doms xv)) rd (:doms rootv) r {}]
               (if xd
                 (let [[xk xv] (first xd)]
                   (if-let [[_ rv] (find rd xk)]
                     (let [nd (-merge-doms xv rv)]
                       (when nd
                         (recur (next xd)
                           (dissoc rd xk) (assoc r xk nd))))
                     (recur (next xd) rd (assoc r xk xv))))
                 (merge r rd)))
        nv (when doms
             (subst-val (:v rootv) doms eset
               (merge (meta xv) (meta rootv))))]
    (when nv
      (-> s
        (ext-no-check root nv)
        (update-eset doms eset)))))
Vars in clojure.core.logic/merge-with-root:
Used in 0 other vars

Comments top

No comments for merge-with-root. Log in to add a comment.