clara

http://www.clara-rules.org/
Busy escaping the comfort zone 2020-04-02T11:40:04.011900Z

BTW I think that I have a very interesting use case for Clara rules, once done ill share it but I'm very excited about it

👀 1
Busy escaping the comfort zone 2020-04-02T14:19:51.014700Z

Hi Clara team, is there an option to run a query that matches any fact? for example:

(defquery get-failures [] 
    (?f <- [_ true]))
Assuming that the first value in the vector is not important we only care for the second true value

Busy escaping the comfort zone 2020-04-02T14:20:51.015500Z

Or alternatively:

(defquery get-failures [] 
    (?f <- _ (= ?failure true)))

Busy escaping the comfort zone 2020-04-02T14:22:14.015900Z

(looks like ancestors-fn might be useful in such a case?)

ethanc 2020-04-02T14:26:09.017500Z

A rule/query that has a fact type of Object would find all facts

Busy escaping the comfort zone 2020-04-02T14:36:30.019700Z

In my case I'm using a keyword as the fact type, if I understand this correctly (ancestors :foo) is nil so Object dosent capture this?

Busy escaping the comfort zone 2020-04-02T14:36:46.020Z

(defquery get-failures [] 
    (?f <- Object (= ?failure true)))

Busy escaping the comfort zone 2020-04-02T14:37:09.020400Z

Sounds like I need to use an actual clojure keys hierarchy?

ethanc 2020-04-02T14:46:44.022300Z

ah when using a custom fact-type-fn i think the only reliable way to achieve this would be to also provide a matching custom ancestors-fn

Busy escaping the comfort zone 2020-04-02T14:47:38.022600Z

Makes sense, ill continue to fiddle with it

Busy escaping the comfort zone 2020-04-02T14:47:40.022800Z

Thanks