我试图按照(链接:这篇博客文章)(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")]
`