Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (ns dinesman
- (:refer-clojure :exclude [==])
- (:use clojure.core.logic))
- (defne aboveo [x y l]
- ([_ _ [y . r]]
- (membero x l))
- ([_ _ [z . r]]
- (!= z y)
- (aboveo x y r)))
- (defne not-above1o [x y l]
- ([_ _ ()])
- ([_ _ [a . ()]])
- ([_ _ [a x . r]] (!= a y))
- ([_ _ [_ a . r]]
- (!= a x)
- (fresh [nl]
- (conso a r nl)
- (not-above1o x y nl))))
- (defn not-adjacento [x y l]
- (all
- (not-above1o x y l)
- (not-above1o y x l)))
- (run* [q]
- (fresh [a b c d e]
- (== q [a b c d e])
- (permuteo [:Baker :Cooper :Fletcher :Miller :Smith] q)
- (!= e :Baker) (!= a :Cooper)
- (!= e :Fletcher) (!= a :Fletcher)
- (aboveo :Miller :Cooper q)
- (not-adjacento :Smith :Fletcher q)
- (not-adjacento :Fletcher :Cooper q)))
Add Comment
Please, Sign In to add comment