File tree Expand file tree Collapse file tree
main/clojure/clojure/core
test/clojure/clojure/core Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -19,26 +19,26 @@ core.unify provides a la carte unification facilities that are not deeply tied i
1919Releases and Dependency Information
2020========================================
2121
22- Latest stable release: 0.7.0
22+ Latest stable release: 0.7.1
2323
2424* [ All Released Versions] ( https://search.maven.org/#search%7Cgav%7C1%7Cg%3A%22org.clojure%22%20AND%20a%3A%22core.unify%22 )
2525* [ Development Snapshot Versions] ( https://oss.sonatype.org/index.html#nexus-search;gav~org.clojure~core.unify~~~ )
2626
2727[ CLI/` deps.edn ` ] ( https://clojure.org/reference/deps_and_cli ) dependency information:
2828``` clojure
29- org.clojure/core.unify {:mvn/version " 0.7.0 " }
29+ org.clojure/core.unify {:mvn/version " 0.7.1 " }
3030```
3131
3232[ Leiningen] ( https://github.com/technomancy/leiningen ) dependency information:
3333
34- [org.clojure/core.unify "0.7.0 "]
34+ [org.clojure/core.unify "0.7.1 "]
3535
3636[ Maven] ( https://maven.apache.org/ ) dependency information:
3737
3838 <dependency>
3939 <groupId>org.clojure</groupId>
4040 <artifactId>core.unify</artifactId>
41- <version>0.7.0 </version>
41+ <version>0.7.1 </version>
4242 </dependency>
4343
4444
Original file line number Diff line number Diff line change 66 :1.9 {:override-deps {org.clojure/clojure {:mvn/version " 1.9.0" }}}
77 :1.10 {:override-deps {org.clojure/clojure {:mvn/version " 1.10.3" }}}
88 :1.11 {:override-deps {org.clojure/clojure {:mvn/version " 1.11.4" }}}
9- :1.12 {:override-deps {org.clojure/clojure {:mvn/version " 1.12.0 " }}}
9+ :1.12 {:override-deps {org.clojure/clojure {:mvn/version " 1.12.4 " }}}
1010 ; ; suitable for Clojure 1.8 or later:
1111 :runner
1212 {:extra-deps {io.github.cognitect-labs/test-runner
Original file line number Diff line number Diff line change 126126 binds)))))
127127
128128(defn flatten-bindings
129- " Flattens recursive bindings in the given map to the same ground (if possible)."
129+ " Flattens recursive bindings in binds to the same ground, if possible.
130+ If a variable cannot be resolved then it is left in place."
130131 ([binds] (flatten-bindings lvar? binds))
131132 ([variable? binds]
132- (into {}
133- (remove (comp nil? second)
134- (map (fn [[k v]]
135- [k (loop [v v]
136- (if (variable? v)
137- (recur (binds v))
138- v))])
139- binds)))))
133+ (into {}
134+ (map (fn [[k v]]
135+ [k (loop [v v]
136+ (if-let [entry (and (variable? v) (find binds v))]
137+ (recur (val entry))
138+ v))])
139+ binds))))
140140
141141(defn- try-subst
142142 [variable? x binds]
Original file line number Diff line number Diff line change 99(ns ^{:doc " A unification library for Clojure."
1010 :author " Michael Fogus" }
1111 clojure.core.unify-test
12- (:require [clojure.core.unify :refer [unify]]
12+ (:require [clojure.core.unify :refer [unify] :as u ]
1313 [clojure.test :refer [deftest is testing]]))
1414
1515#?(:clj (println " \n Testing with Clojure" (clojure-version ))
6363 (is (= '{?y (2 3 )} (#'clojure.core.unify/garner-unifiers '(_ & ?y) [1 2 3 ]))))
6464
6565(deftest test-flatten-bindings
66- (is (= '{?y a, ?x a} (#'clojure.core.unify/flatten-bindings '{?y a, ?x ?y}))))
66+ (is (= '{?y a, ?x a} (u/flatten-bindings '{?y a, ?x ?y})))
67+ (is (= '{?z a, ?x ?y} (u/flatten-bindings '{?x ?y, ?z a})))
68+ (is (= {'?x nil } (u/flatten-bindings '{?x nil }))))
6769
6870
6971(deftest test-unifier*
You can’t perform that action at this time.
0 commit comments