Fork me on GitHub
#clara
<
2020-04-02
>
narkisr11:04:04

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
narkisr14:04:51

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

narkisr14:04:51

Or alternatively:

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

narkisr14:04:14

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

ethanc14:04:09

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

narkisr14:04:30

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?

narkisr14:04:46

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

narkisr14:04:09

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

ethanc14:04:44

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

narkisr14:04:38

Makes sense, ill continue to fiddle with it