We are using a forward-chaining rule system where we have to spoon-feed the system the data it needs to make a decision. I'd prefer the rule system can ask the questions to obtain the data needed for decisioning. In Jess, this seems possible with the magical "need-" prefix:
(defrule create-member
(need-member $?)
=>
(assert (member A B))) ; eg. DB call to check membership, if needed for goal finding.
(defrule rule-1
(member ?A ?B)
=>
(printout t member crlf))
With this solution, unneeded facts are not fetched. Also, salience could be used to help avoid more costly fact look-up (eg. remote calls), also would keep code DRY
Although Jess appears to solve this, a license-free Clojure solution is preferred. However, it's obscure how to pull this off with say clojure.logic for example. Clara uses forward-chaining, which seems like a no-go, but possibly with rule generation a Jess-like hack is possible?
Really looking for an example of doing similar in Clojure.
Just so it is linked from here, someone answered to Joel this very question on Ask Clojure: Ask Clojure: Can core.logic ask questions?
The answer is as follows: