Is it possible to create an anonymous session? Like mk-session in clara.
Not currently. Why do you ask?
I'm fooling around in the repl, it's quite convenient to be anonymous. I'm not doing anything with clojurescript at all.
Ah ok
(My questions become moot if the #clara datom system is separate, but that's a separate conversation)
I haven’t used it much in CLJ but want to (stream processing in particular). Let me look at the code real quick see if there’s something that might be halfway helpful
Not sure if you have the repo cloned but I think if session
returned that you’d have a defless session
I do have it :) yeah.
Are subscriptions the equivalent of Clara queries? Sorry, I appreciate I'm coming at this in an unorthodox way.
Live queries basically. They’re rules under the covers. They don’t take parameters currently. They still get compiled into the rete graph because they’re rules
Queries do too though
I’ve wanted to use the ave eav indexes we have for queries instead. Could be more performant
In CLJS they end up being just like reframe subscriptions and are implemented with reagent cursors/atoms. In CLJ it might be more appropriate to back them with core.async
I was getting nil for the visible to-do subscription. Any reason they might not work in Clojure?
Yeah. I haven’t found or implemented a cursor equivalent
I’m surprised I don’t have an issue open for it cause it’s been on my mind. But not sure whether in CLJ it’d be more useful to have something like a core.async channel that receives updates vs a dereffable thing
If you’re poking around:
(defn get-sub [state-m k]
(let [sub-name->sub-map (->> (:subscriptions state-m)
(vals)
(util/key-by :name))]
(get-in sub-name->sub-map [k :lens])))
(defn list-subs [state-m]
(->> (:subscriptions state-m)
(vals)
(map :name)))
(defn get-attributes [store-m]
(->> store-m
(vals)
(into {})
(keys)))
(defn get-entity [store-m eid]
(get store-m eid))
where store-m is @precept.state/store, state-m is @precept.state/state
Rather than core.async, callbacks are more "open". Rh advice is to use them rather than a hard dependency.
Ok. I’m interested to hear you thoughts… on all of this. Cause I don’t know. I’m not sure what people would want to use Clara or Precept for, especially with CLJ. For me I’d want a stream of matches for a rule, maybe with the ability to apply transducers. I don’t know…interface could be both I guess
I'll have a poke.
In part because in CLJ my aspirations would be stream processing with Kafka
My use case is unusual, so probably not the best basis. I want to derive JSON from facts, with rules to enrich facts with inferences.
Well, I’m really interested if you’re able and willing to say more. Curious for one, helps think about possible implementations a lot too though
I am able. I am willing. I want an API to talk at a highish level about deployments. a runs Clojure. A talks to b. B is a database, etc. Then a series of rules will generate facts about auto scaling groups, adding RDS databases, setting up firewall rules and so on. I will then collect up all the data and create terraform or cloud formation.
Wow. Nice
Are you designing it as a one time calculation? Or are you doing something like live monitoring
One time calculation. Which I know is unusual.
Not so sure about that with rule engines actually. From what I’ve heard about Cerner it’s more “solve this” rather than a constantly running thing. Very cool
We're all very comfortable with Datomic, so having tuples for facts is ideal.
That’s great. Hoping I have a chance to use it at work soon. How do you handle things like ordered lists, sets, and other collections of things? We made the decision to allow anything in the value slot which I think makes some sense for UI at least
I'll let you know. I've not gone that far yet.