Fork me on GitHub
#clara
<
2019-02-20
>
dominicm12:02:30

http://www.clara-rules.org/docs/rules/ mentions "props", but I can't see documentation for them on that page. Does anyone know what they are?

ethanc14:02:12

@dominicm it is a simple map, currently the only thing supported would be salience, i think. http://www.clara-rules.org/docs/conflictsalience/

mikerod14:02:58

@dominicm @ethanc there is also :no-loop

mikerod14:02:21

However, it’s typically not recommended to write rules in a way where you have to use that

mikerod14:02:25

it can have confusing semantics I believe

mikerod14:02:40

(probably why it hasn’t been documented much 😛 )

dominicm14:02:32

Is it possible to create rules with parameters? And be explicit about passing them in?

mikerod14:02:02

@dominicm It isn’t clear to me how that would work in general

mikerod14:02:10

However, queries take parameters if that’s more what you’re looking for

mikerod14:02:38

For rules, instead of taking a parameter, model the param as a fact inserted by a rule perhaps

mikerod14:02:57

Instead of

(defrule param-rule
  [A (= <my-param-here> x)]
  =>
  <do things>)
Do
(defrule find-param
  [?i <- InputFact]
  =>
  (insert! (map->Param (extract-data ?i))))

(defrule param-rule
  [?p <- Param]
  [A (= (:x ?p) x)]
  =>
  <do things>)

dominicm14:02:12

@mikerod hmm, maybe I haven't thought it through. But I want to write rules like "for every X insert 5", where I might have multiple of these inserted.

dominicm14:02:15

Ah, right, of course.

dominicm14:02:38

My rule just needs to find "Candidate X", and then insertions can be made about X candidate. 🙂

mikerod14:02:56

I think so