【发布时间】:2018-12-15 12:46:54
【问题描述】:
我正在尝试学习 clara 规则 - "http://www.clara-rules.org/docs/firststeps/" 中存在的 clojure
(ns with-mongo.clara.example
(:require [clara.rules :refer :all]))
(defrecord SupportRequest [client level])
(defrecord ClientRepresentative [name client])
(defrule is-important
"Find important support requests."
[SupportRequest (= :high level)]
=>
(println "High support requested!"))
(defrule notify-client-rep
"Find the client representative and request support."
[SupportRequest (= ?client client)]
[ClientRepresentative (= ?client client) (= ?name name)]
=>
(println "Notify" ?name "that"
?client "has a new support request!"))
在 REPL 中执行以下操作
(-> (mk-session 'with-mongo.clara.example)
(insert (->ClientRepresentative "Alice" "Acme")
(->SupportRequest "Acme" :high))
(fire-rules))
但是我在 eclipse 中得到的是 CompilerException java.lang.RuntimeException: Unable to resolve symbol: fire-rules in this context, 编译:(C:\Users\x\AppData\Local\Temp\form-init8304513432405616575.clj:1:2)
有没有人有详细的介绍?
【问题讨论】:
标签: clojure