This is a real noob question - I'm trying to grok how to use the rules' engine and I think maybe due to a lack of background in relevant areas (databases?) the terminology has left me a bit confusing. I'm struggling to map them to Clojure concepts
For instance a little snippet:
https://github.com/oakes/play-cljc-examples/blob/master/dungeon-crawler/src/dungeon_crawler/session.cljc
::move-player
[:what
[::time ::delta delta-time]
[::window ::width width]
As I'm understanding .. implicit is that there is some state atom that looks something like
{:time {:delta-time 666}
:window {:width 999}}
So a rule like [::time ::delta delta-time] is a pair of keys. You get the val for ::time and then the val of ::delta. The value is bound to delta-time. When this value changes the rule triggers
I guess my question would be, why is the interface not like in update-in or assoc-in with a arbitrary length vector of keys [[::time ::delta] delta-time]?
You have some other examples where you then use the bound value to "drill down" further in subsequent rules (maybe with a vector of keys you wouldn't need to?)
I can understand how if you have a to-do list, the first key being an id makes sense. But in simpler scenarios maybe you wouldn't even have that. For instance a super simple toy example of a map describing a cylinder:
and I'd like to derive are-of-base, circumference-of-base, volume (all 3 change if the :radius changes, but only the last changes if the :height is changed)
I'm kinda confused as to how to map this to a rules' engine's [id attrib value] triplet system
This is a real noob question - I'm trying to grok how to use the rules' engine and I think maybe due to a lack of background in relevant areas (databases?) the terminology has left me a bit confusing. I'm struggling to map them to Clojure concepts
For instance a little snippet:
https://github.com/oakes/play-cljc-examples/blob/master/dungeon-crawler/src/dungeon_crawler/session.cljc
As I'm understanding .. implicit is that there is some state atom that looks something like
So a rule like
[::time ::delta delta-time]is a pair of keys. You get thevalfor::timeand then thevalof::delta. The value is bound todelta-time. When this value changes the rule triggersI guess my question would be, why is the interface not like in
update-inorassoc-inwith a arbitrary length vector of keys[[::time ::delta] delta-time]?You have some other examples where you then use the bound value to "drill down" further in subsequent rules (maybe with a vector of keys you wouldn't need to?)
I can understand how if you have a to-do list, the first key being an
idmakes sense. But in simpler scenarios maybe you wouldn't even have that. For instance a super simple toy example of a map describing a cylinder:and I'd like to derive
are-of-base,circumference-of-base,volume(all 3 change if the:radiuschanges, but only the last changes if the:heightis changed)I'm kinda confused as to how to map this to a rules' engine's
[id attrib value]triplet system