clara

http://www.clara-rules.org/
2017-12-24T00:44:18.000006Z

@alex-dixon I made a blog post on the topic of “fact updates” in Clara @ http://www.metasimple.org/2017/12/23/clara-updating-facts.html Perhaps something like it could be added to Clara docs later.

2017-12-24T00:44:45.000018Z

It is basically just reiterating things I’ve discussed before in this Slack channel on the topic. We discussed this a little a day or so ago.

alex-dixon 2017-12-24T00:45:30.000036Z

Awesome. Thanks. Will read and share

2017-12-24T00:46:08.000005Z

cool. feel free to let me know if you see problems with it or anything too

alex-dixon 2017-12-24T16:18:10.000035Z

Very well written. Really impressed at how quickly you were able to produce that… 🙂

2017-12-24T16:24:28.000059Z

Thanks!

alex-dixon 2017-12-24T16:31:12.000012Z

I haven’t figured out a good solution for “default values” of facts. E.g. I have some rules I’m working on now for precept-devtools where I’m trying to allow the user to view history for a rule. When the user first selects “show history”, I want to provide a default (e.g. the first rule firing). After that I want the user to be able to switch through the selected history. I’d like to have one “selected history” fact. If it doesn’t exist because the user hasn’t set it, it should be derived from other facts. If the user sets it though, then “selected history” should be whatever the user says.

2017-12-24T16:33:05.000107Z

That sounds like you could encode that as 2 separate rules that both insert the selected history fact

alex-dixon 2017-12-24T16:33:16.000002Z

To get a default I’m writing something like “[:not {SelectedHistory} => (insert-unconditional! [SelectedHistory 0])”

2017-12-24T16:33:24.000045Z

One rule would only fire if some user provided fact is not present.

2017-12-24T16:33:43.000045Z

Yeah. Use a different fact type as the “trigger”

2017-12-24T16:34:11.000095Z

And no need for unconditional

2017-12-24T16:36:21.000057Z

[:not [SelectHistoryEvent]]
=>
(insert! (->SelectedHistory 0))

2017-12-24T16:37:15.000062Z

The other rule would be the same, but would use the event to build the SelectedHistory with the provided value

2017-12-24T16:37:49.000015Z

And if you want the ability to retract/toggle do some sort of external retract like I described in blog perhaps.

alex-dixon 2017-12-24T16:38:35.000025Z

Ok. I’ll try that. Thanks

2017-12-24T17:45:16.000076Z

Time to write a “defaulting facts” blog! 😛

alex-dixon 2017-12-24T19:01:59.000053Z

Sorry….don’t mean to create work for you. I’m still figuring out patterns. I think UI might be different from the way Clara is normally used? Maybe not but there are facts coming from the outside virtually all the time and I’ve often wondered if that’s significantly different from the use case at Cerner

2017-12-24T19:24:50.000034Z

Oh no not a problem. I want to do things like write more blogs anyways. Hah. But yeah I think the UI usage of Clara pushes new things up to the forefront. But that is a good thing

2017-12-24T19:25:24.000086Z

I’m doing quite a bit of UI things recently and I think some stuff you’ve been doing seems really interesting. I really want to look at it a bit more soon.

alex-dixon 2017-12-27T15:14:58.000124Z

Thanks! That means a lot coming from you 🙂. If it’d make things easier or faster maybe we could screenshare or just chat and go over example UI rules. Your feedback on some of the patterns we’ve used in Precept so far would be invaluable

2017-12-27T17:20:07.000178Z

Yeah, that could work. I’ll try to find some time available soon for something like that. I want to do a little bit of a read through of precept to have some insight too. I like to read open-source libs doing interesting things anyways.

sparkofreason 2017-12-24T02:27:43.000012Z

Brain bubble: clara and onyx might be a great match for distributed processing.

🎉 2
sparkofreason 2017-12-24T22:32:45.000018Z

After reading this (https://clojurians-log.clojureverse.org/clara/2015-12-11.html) and @mikerod's article (http://www.metasimple.org/2017/02/28/clarifying-rules-engines.html), I think there may be something there. It's all sky pie at this point, but it certainly seems like the network should be translatable to an onyx job. Onyx has fault tolerance for stateful tasks, and has taken a pretty good beating from jepsen.