Skip to content

Commit

Permalink
Upgraded core.logic version
Browse files Browse the repository at this point in the history
  • Loading branch information
frenchy64 committed Oct 29, 2011
1 parent c96e5b6 commit 03d1562
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion project.clj
Expand Up @@ -3,4 +3,4 @@
:dependencies [[org.clojure/clojure "1.3.0"]
[match "0.2.0-SNAPSHOT"]
[org.clojure/data.json "0.1.1"]
[org.clojure/core.logic "0.6.2"]])
[org.clojure/core.logic "0.6.4"]])
2 changes: 1 addition & 1 deletion src/logic_introduction/core.clj
Expand Up @@ -20,7 +20,7 @@
((geto exp context result-type))
((matche [context exp result-type]
([_ [:apply ?fun ?arg] _]
(exist [arg-type]
(fresh [arg-type]
(!= ?fun ?arg)
(typedo context ?arg arg-type)
(typedo context ?fun [arg-type :> result-type])))))))
Expand Down
10 changes: 5 additions & 5 deletions src/logic_introduction/numbers.clj
Expand Up @@ -47,7 +47,7 @@
of x and y"
(matche [x y z]
([zero _ zero])
([(s ?x) _ _] (exist [xy]
([(s ?x) _ _] (fresh [xy]
(times ?x y xy)
(plus xy y z)))))

Expand All @@ -57,15 +57,15 @@
(matche [n x y]
([(s ?x) zero zero])
([zero (s ?x) (s zero)])
([(s ?n) _ _] (exist [z]
([(s ?n) _ _] (fresh [z]
(exp ?n x z)
(times z x y)))))

(defn factorial [n f]
"f equals n factorial"
(matche [n f]
([zero (s zero)])
([(s ?n) _] (exist [f1]
([(s ?n) _] (fresh [f1]
(factorial ?n f1)
(times (s ?n) f1 f)))))

Expand All @@ -78,7 +78,7 @@
(defn modo [x y z]
"z is the remainder of the integer division of x by y"
(<o z y)
(exist [q qy]
(fresh [q qy]
(times y q qy)
(plus qy z x)))

Expand All @@ -88,7 +88,7 @@
(matche [x y a]
([zero ?n (s ?n)])
([(s ?m) zero ?val] (ackermann ?m (s zero) ?val))
([(s ?m) (s ?n) ?val] (exist [val1]
([(s ?m) (s ?n) ?val] (fresh [val1]
(ackermann (s ?m) ?n val1)
(ackermann ?m val1 ?val)))))

Expand Down

0 comments on commit 03d1562

Please sign in to comment.