precept

Preception!
dominicm 2018-05-17T16:18:55.000301Z

Is it possible to create an anonymous session? Like mk-session in clara.

alex-dixon 2018-05-17T16:19:43.000637Z

Not currently. Why do you ask?

dominicm 2018-05-17T16:22:13.000120Z

I'm fooling around in the repl, it's quite convenient to be anonymous. I'm not doing anything with clojurescript at all.

alex-dixon 2018-05-17T16:22:32.000123Z

Ah ok

dominicm 2018-05-17T16:23:03.000609Z

(My questions become moot if the #clara datom system is separate, but that's a separate conversation)

alex-dixon 2018-05-17T16:24:41.000144Z

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

alex-dixon 2018-05-17T16:31:22.000196Z

Not sure if you have the repo cloned but I think if session returned that you’d have a defless session

dominicm 2018-05-17T16:41:15.000126Z

I do have it :) yeah.

dominicm 2018-05-17T16:41:48.000648Z

Are subscriptions the equivalent of Clara queries? Sorry, I appreciate I'm coming at this in an unorthodox way.

alex-dixon 2018-05-17T16:56:28.000833Z

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

alex-dixon 2018-05-17T16:56:48.000299Z

Queries do too though

alex-dixon 2018-05-17T16:58:11.000284Z

I’ve wanted to use the ave eav indexes we have for queries instead. Could be more performant

alex-dixon 2018-05-17T17:00:42.000666Z

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

dominicm 2018-05-17T17:31:06.000568Z

I was getting nil for the visible to-do subscription. Any reason they might not work in Clojure?

alex-dixon 2018-05-17T17:31:52.000223Z

Yeah. I haven’t found or implemented a cursor equivalent

alex-dixon 2018-05-17T17:34:04.000511Z

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

alex-dixon 2018-05-17T17:35:45.000659Z

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))

alex-dixon 2018-05-17T17:36:34.000504Z

where store-m is @precept.state/store, state-m is @precept.state/state

dominicm 2018-05-17T17:38:07.000516Z

Rather than core.async, callbacks are more "open". Rh advice is to use them rather than a hard dependency.

alex-dixon 2018-05-17T17:40:15.000193Z

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

dominicm 2018-05-17T17:40:22.000354Z

I'll have a poke.

alex-dixon 2018-05-17T17:41:32.000691Z

In part because in CLJ my aspirations would be stream processing with Kafka

dominicm 2018-05-17T17:42:11.000740Z

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.

alex-dixon 2018-05-17T17:44:39.000511Z

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

dominicm 2018-05-17T18:24:06.000353Z

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.

alex-dixon 2018-05-17T18:39:43.000630Z

Wow. Nice

alex-dixon 2018-05-17T18:40:43.000760Z

Are you designing it as a one time calculation? Or are you doing something like live monitoring

dominicm 2018-05-17T18:42:50.000524Z

One time calculation. Which I know is unusual.

alex-dixon 2018-05-17T18:45:31.000543Z

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

dominicm 2018-05-17T18:53:21.000277Z

We're all very comfortable with Datomic, so having tuples for facts is ideal.

alex-dixon 2018-05-17T18:59:08.000278Z

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

dominicm 2018-05-17T19:03:11.000489Z

I'll let you know. I've not gone that far yet.