Fork me on GitHub
#clara
<
2020-08-06
>
briancabbott15:08:09

Hi, I am having a problem with resolving a defrecord call that resides in a seperate namespace from the rule defininitions. I was wondering if someone might be able to help me out. I have the code I made for a small prototype that repros the issue here: https://github.com/briancabbott/clara-rules-test

mikerod15:08:45

@briancabbott in CLJ to refer to a defrecord created type you have to use the java interop :import

mikerod15:08:08

So it’s not represented as a var. so :require + :refer won’t work.

mikerod15:08:40

It’s somewhat unfortunate. In CLJS you actually can refer to them as non-interop style symbols.

mikerod15:08:09

So something like. : `(:import [ clara_rules_test.parent_rules_split_ns.rule_records MyFirstRecordOne MyFirstRecordTwo])`

mikerod15:08:54

Not also the need for underscores instead of hyphens. Again. That’s the java interop part. Cannot have hyphens in class names on JVM so clj converts them (called “munching”) to underscores.

briancabbott16:08:19

BAM!!! HELL YES! 🙂 Thank you my friend --- you are my Savior!

eraserhd20:08:30

It's been a while... are there any issues with [:not [:exists ...]]? I have a rule that is firing, even though the LHS has [:exists A] [:not [:exists A]].

ethanc14:08:52

Thats an interesting scenario, i will have to look into whats going on there

eraserhd20:08:40

oh, while that is not correct, it is actually silly to say [:not [:exists A]] instead of [:not A], huh