Permalink
Browse files

* README.md: LOGIC-20: new conde style

  • Loading branch information...
swannodette committed Nov 28, 2011
1 parent 13073c7 commit de34c3ed961b76e5cbc76169975bdc48c033beae
Showing with 232 additions and 233 deletions.
  1. +6 −6 README.md
  2. +7 −8 src/main/clojure/clojure/core/logic/bench.clj
  3. +219 −219 src/test/clojure/clojure/core/logic/tests.clj
View
@@ -89,16 +89,16 @@ Here's a simple type inferencer for the simply typed lambda calculus based on a
(defn typedo [c x t]
(conda
- ((lvaro x) (findo x c t))
- ((matche [c x t]
+ [(lvaro x) (findo x c t)]
+ [(matche [c x t]
([_ [[?x] :>> ?a] [?s :> ?t]]
(fresh [l]
(conso [?x :- ?s] c l)
(typedo l ?a ?t)))
([_ [:apply ?a ?b] _]
(fresh [s]
(typedo c ?a [s :> t])
- (typedo c ?b s)))))))
+ (typedo c ?b s))))]))
(comment
;; ([_.0 :> _.1])
@@ -147,10 +147,10 @@ core.logic as of version 0.5.4 supports tabling. Certain kinds of logic programs
(def patho
(tabled [x y]
(conde
- ((arco x y))
- ((fresh [z]
+ [(arco x y)]
+ [(fresh [z]
(arco x z)
- (patho z y))))))
+ (patho z y))])))
;; (:b :a :d)
(run* [q] (patho :a q))
@@ -66,13 +66,12 @@
(defn nexto [x y l]
(conde
- ((righto x y l))
- ((righto y x l))))
+ [(righto x y l)]
+ [(righto y x l)]))
(defn zebrao [hs]
(all
- (== [(lvar) (lvar) [(lvar) (lvar) 'milk (lvar) (lvar)] (lvar) (lvar)] hs)
- (firsto hs ['norwegian (lvar) (lvar) (lvar) (lvar)])
+ (== [(lvar) (lvar) [(lvar) (lvar) 'milk (lvar) (lvar)] (lvar) (lvar)] hs) (firsto hs ['norwegian (lvar) (lvar) (lvar) (lvar)])
(nexto ['norwegian (lvar) (lvar) (lvar) (lvar)] [(lvar) (lvar) (lvar) (lvar) 'blue] hs)
(righto [(lvar) (lvar) (lvar) (lvar) 'ivory] [(lvar) (lvar) (lvar) (lvar) 'green] hs)
(membero ['englishman (lvar) (lvar) (lvar) 'red] hs)
@@ -230,7 +229,7 @@
(defne partitiono [a b c d]
([[?x . ?l] _ [?x . ?l1] _]
(conda
- ((project [?x b]
- (== (<= ?x b) true))
- (partition ?l b ?l1 d))
- (partition ?l b c d))))
+ ((project [?x b]
+ (== (<= ?x b) true))
+ (partition ?l b ?l1 d))
+ (partition ?l b c d))))
Oops, something went wrong.

0 comments on commit de34c3e

Please sign in to comment.