我试图跟随(链接:这篇博文)提供的示例(链接:https://mattsenior.com/2014/02/using-clojures-core-logic-to-solve-simple-number-puzzles),并发现只有在我删除了测试减法得到负结果的条件后它才能正常工作。我移除了很多不同的东西,发现即使是最基本的示例也无法找到任何匹配项。
`
(ns example.core
(:refer-clojure :exclude (link: ==))
(:require (link: clojure.core.logic :refer :all))
(:require (link: clojure.core.logic.fd :as fd)))
(run* (link: q)
(fresh (link: a0 a1)
(== q (link: a0 a1))
(fd/in a0 a1 (fd/interval 1 9))
(fd/- a0 a1 -1)
;(fd/eq
; (= (- a0 a1) -1))
))
`
依赖项(尽管我也尝试了clojure 1.8和1.9版本)
`
:dependencies (link: [org.clojure/clojure "1.7.0")
(link: org.clojure/core.logic "0.8.11")]
`