clara

http://www.clara-rules.org/
Matthew Pettis 2020-01-22T01:51:56.023700Z

I agree; I don't need dynamic rules. I more needed a hint as to the fact that they are supplied and loaded upon mk-session.

Matthew Pettis 2020-01-22T01:53:14.023900Z

To that end, I tried your advice, I think I did it faithfully, and wasn't able to make it work yet. My adjustments are at this commit: https://github.com/mpettis/clara-ns-ex/tree/0bdb72e98a8ef657de08579af6ee993c9008a738

Matthew Pettis 2020-01-22T01:54:29.024100Z

When I run that, I still get that Myfact class cannot be found. I think I'm probably missing something about using defrecord definitions from other namespaces.

Matthew Pettis 2020-01-22T02:04:04.024500Z

Also, for a baseline, this is how I make it work when everything is in the same namespace... https://github.com/mpettis/clara-ns-ex/blob/nonamespace/src/clara_ns_ex/core.clj

2020-01-22T02:28:59.025700Z

@matthew.pettis so you’re issue isn’t just referring to record symbols. Have to follow normal clojure symbol resolution rules.

2020-01-22T02:29:12.026300Z

So you require the ns that defines the records - to ensure it is compiled.

2020-01-22T02:29:46.027400Z

Then you typically would use :import in clj (not cljs) to refer to the record class name as the shortened version

2020-01-22T02:30:16.028300Z

Otherwise you’d have to fully qualify it each reference clara_ns_ex.facts.Myfact

Matthew Pettis 2020-01-22T02:40:22.028600Z

Thanks. I thought about that a bit more after I posted, I'll think a bit more carefully about resolution rules, and think I may get it... Thanks for the help; learning Clojure as I learn Clara here...

2020-01-22T03:20:55.029100Z

No problem. Let me know if more questions

2020-01-22T03:21:12.029800Z

I’d give better examples but typing on mobile is hard hah

👍 1
Matthew Pettis 2020-01-22T03:47:34.030100Z

I really appreciate the help.

Matthew Pettis 2020-01-22T04:19:34.030300Z

fyi, i think i'm closer, but I can't decipher the location of where the error of can't find Class for Myfact, as it won't tell me at what line it is failing. This is the state that I have it: https://github.com/mpettis/clara-ns-ex/tree/f3d6f67346eacb61294205f6da0e1f3073e7428a

Matthew Pettis 2020-01-22T04:21:29.030500Z

I have the import statements, I tested that it worked. I referenced these pages that went with the hint that @mikerod gave me on using import: https://danielcompton.net/2016/05/04/requiring-records-clojure-clojurescript and https://stackoverflow.com/a/23420084/1022967

Matthew Pettis 2020-01-22T04:39:52.030800Z

OK, I got it to work by playing with what did and did not need namespace qualified names, and where. I don't fully understand the rules of when I should and should not yet, but I have a working example to go off of, so thanks for all of your help! Here is the commit that has a working example: https://github.com/mpettis/clara-ns-ex/tree/d077c141d305ef217043bcf44a328c6921311847

Matthew Pettis 2020-01-22T14:34:02.037900Z

👍 1
2020-01-22T16:43:08.038400Z

@matthew.pettis nice, glad to see you sorted it out - looks better too

👍 1
Matthew Pettis 2020-01-22T20:44:23.039800Z

Thanks again for the help. I think it is helpful to have an example for clara-rules that leverages namespaces. I think I'll see if cerner/clara-examples would consider adding it as an example. Or somewhere. Nice to have a battery of examples for some of this...

2020-01-22T20:50:53.041100Z

@matthew.pettis yeah more examples could be good. Not sure when the last time that repo was updated. But perhaps it is the right place. There are also docs that maybe could explain some things more

2020-01-22T20:51:17.041300Z

http://www.clara-rules.org

Matthew Pettis 2020-01-22T20:57:18.044800Z

@mikerod Yep, started there, read the documentation, some of it was vague to me, and not sure if is lack of experience on my part or it just doesn't have attention anymore to curate. Also, fwiw, I am making a different repo of collected small steps for myself for self-training. In this link, I use clara-rules to solve a logic puzzle, much like could be done with core.logic. However, I did it in clara-rules not because it was more efficient (oh, my example is real slow and memory hoggy), but because it mimicked a different scenario I think I want to apply clara-rules to. Here is that particular example... https://github.com/mpettis/clara-lien/blob/master/src/clara_lein/ex05.clj

👍 1
2020-01-22T21:28:36.045300Z

that’s interesting, could be something nice to add to docs or examples