Skip to content

Commit

Permalink
Fixes halgari#13 false values not unifying with lvar
Browse files Browse the repository at this point in the history
+ add gitignore
+ fix a few tests that weren't comparing the output
  • Loading branch information
karlmikko committed Jan 17, 2017
1 parent cd2c02a commit 5ef4057
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.lein-failures
target/*
2 changes: 1 addition & 1 deletion src/com/tbaldridge/odin/unification.clj
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
(instance? LVar x))

(defn walk [env a]
(if-let [a (get env a)]
(if-some [a (get env a)]
(recur env a)
a))

Expand Down
13 changes: 11 additions & 2 deletions test/com/tbaldridge/odin_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,20 @@
(is (= (set (o/for-query
(o/and (d/query data _ _ ?v)
(o/when (integer? ?v)))
#{1 2 3}))))
?v))
#{1 2 3}))

(is (= (set (o/for-query
(d/query data _ ?a _)
#{:a :b :c :d :e :f :g})))))))
?a))
#{:a :b :c :d :e :f :g})))))

(deftest false-in-data
(let [data [1 2 3 false]]
(is (= (set (o/for-query
(d/query data _ _ ?val)
?val))
(set data)))))

(o/defrule parent [data ?parent ?child]
(o/and
Expand Down

0 comments on commit 5ef4057

Please sign in to comment.