Fork me on GitHub
#clara
<
2018-01-08
>
cfleming00:01:42

In the docs, there’s an example rule:

(defrule get-windspeeds-from-location
  [?temp <- [Temperature (= ?location location)]]
  [?wind <- (acc/all) :from [WindSpeed (= ?location location)]]
  =>
  ;; do something
)

cfleming00:01:22

Am I correct in thinking that the first condition should actually be [?temp <- Temperature (= ?location location)], i.e. with no nested vectors?

alex-dixon00:01:53

It can be either insofar as I know

alex-dixon00:01:38

@cfleming I have some changes that I’m not totally happy with that try to accommodate that

alex-dixon01:01:45

Oops. Looks like that would entail an “extraneous vcector error”

mikerod01:01:47

@alex-dixon @cfleming I think the first condition of that rule is incorrect

mikerod01:01:35

There shouldn’t be a vector around Temperature in the non-accumulator case. What @cfleming said is right on that one.

mikerod01:01:50

If Clara accepts it. I think it would be with the wrong semantics.

cfleming01:01:54

Great, thanks Mike

alex-dixon01:01:00

[?order <- [WorkOrder (= ?clientid clientid)
              (= scale :big)
              (< (days-between requestdate duedate) 14)]]
=>
CompilerException clojure.lang.ExceptionInfo: Type [WorkOrder (= ?clientid clientid) (= scale :big) (< (days-between requestdate duedate) 14)] is a vector and appears to contain expressions. Is there an extraneous set of brackets in the condition? 

mikerod01:01:35

It’d consider the whole thing to be the “fact type”. Which is related to the issue of ambiguity of syntax when you allow any arbitrary structure for a fact type. We discussed this on some issue recently

cfleming01:01:43

As the unofficial ranter about macro error messages, that’s a very nice message indeed.

mikerod01:01:15

Oh nice. Yeah I guess that case was special cased. Due to it being fairly easy to mistakenly do

wparker15:01:42

@mikerod I haven’t gotten around to doing a comprehensive writeup, but basically I was looking at how to address https://github.com/cerner/clara-rules/issues/343 and ran into what I think are some issues with to-dnf. Basically since the :or operation is actually more of a union in the set theory sense, I think the to-dnf transforms can end up messing with cardinality. For example, [:not [:and A B]] is equivalent to [:or [:not A] [:not B]] in a boolean sense, but the second can match twice and the first can’t in the context of Clara.

mikerod16:01:57

@wparker thanks. I remember the topic better now.