This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-01-29
Channels
- # architecture (14)
- # beginners (184)
- # boot (25)
- # cider (23)
- # clara (9)
- # cljsjs (13)
- # cljsrn (5)
- # clojure (140)
- # clojure-austria (1)
- # clojure-dev (24)
- # clojure-greece (15)
- # clojure-italy (7)
- # clojure-nl (1)
- # clojure-norway (1)
- # clojure-sanfrancisco (10)
- # clojure-spec (39)
- # clojure-uk (28)
- # clojured (1)
- # clojurescript (26)
- # core-async (3)
- # cursive (13)
- # datomic (44)
- # docs (3)
- # emacs (31)
- # events (2)
- # figwheel (4)
- # fulcro (6)
- # graphql (2)
- # hoplon (5)
- # jobs (11)
- # juxt (4)
- # keechma (19)
- # leiningen (1)
- # off-topic (8)
- # om (8)
- # onyx (18)
- # parinfer (2)
- # re-frame (18)
- # reagent (24)
- # ring (4)
- # rum (2)
- # shadow-cljs (26)
- # sql (15)
- # timbre (6)
- # vim (2)
If I have records having a field used for ordering -- like a timestamp -- and want to make rules that reason about or refer to "the immediately preceding X", or "the most recent X to have attribute Y", is Clara well-suited to the purpose?
("immediately preceding" relative to another record, that is, as opposed to, say, an accumulator reflecting the globally most recent insert/assertion).
It can be, I’m currently using it to reason about entities that change over time. I have to admit though that I don’t find it that easy to model (although I could be doing things horribly wrong).
e.g., I have entities of type A
that can change over time (tracked through a timestamp), and other entities of type B
that can change over time in response to the changes to type A
(that is, there is a relation B = f(A))
, and other entities of type C = f(B)
that also change over time in response to changes in B
I find the rules I’m writing to be quite.. cumbersome, and I find myself inserting special facts just to facilitate rule propagation, to prevent e.g., infinite activations
however, the challenges I face come from the /fact/ that changes are inserted as a consequence of rules, if all history was known prior to rule activation, and I wasn’t inserting new facts from rules (that is, growing/extending time
within a given session’s fire-rules
), and I was simply querying certain states throughout a known and unchanging history, that would be perfectly suitable
@tcarls I think that @dadair has some good things to think about in terms of what you are trying to accomplish. Some of it varies according to the situation. Here is an example that I think meets at least one part of your question though
(defrule immediately-preceding
[A (= timestamp ?ts)]
[?preceding <- (acc/max :timestamp :returns-fact true) :from [B (< timestamp ?ts)]]
=>
<etc>)