Provides a map of all the matched values from inside a :then block.
Provides a map of all the matched values from inside a :then block.
Provides the current value of the session from inside a :then or :then-finally block.
Provides the current value of the session from inside a :then or :then-finally block.
(->rule [rule-name parsed-rule])
(->rule rule-name rule)
Returns a new rule. In most cases, you should use the ruleset
macro to define rules,
but if you want to define rules dynamically, you can use this function instead.
See the README section "Defining rules dynamically".
The one-argument arity is only meant for internal use.
Returns a new rule. In most cases, you should use the `ruleset` macro to define rules, but if you want to define rules dynamically, you can use this function instead. See the README section "Defining rules dynamically". The one-argument arity is only meant for internal use.
(add-rule session rule)
Adds a rule to the given session.
Adds a rule to the given session.
(contains? session id attr)
Returns true if the session contains a fact with the given id and attribute.
Returns true if the session contains a fact with the given id and attribute.
(fire-rules session)
(fire-rules session opts)
Fires :then and :then-finally blocks for any rules whose matches have been updated. The opts map may contain:
:recursion-limit - Throws an error if rules recursively trigger this many times. The default is 16. Pass nil to disable the limit entirely.
Fires :then and :then-finally blocks for any rules whose matches have been updated. The opts map may contain: :recursion-limit - Throws an error if rules recursively trigger this many times. The default is 16. Pass nil to disable the limit entirely.
(insert session [id attr value])
(insert session id attr->value)
(insert session id attr value)
Inserts a fact into the session. Can optionally insert multiple facts with the same id.
Note: if the given fact doesn't match at least one rule, it will be discarded.
Inserts a fact into the session. Can optionally insert multiple facts with the same id. Note: if the given fact doesn't match at least one rule, it will be discarded.
(insert! id attr->value)
(insert! id attr value)
Equivalent to:
(o/reset! (o/insert o/session id attr value))
Equivalent to: (o/reset! (o/insert o/*session* id attr value))
(query-all session)
(query-all session rule-name)
When called with just a session, returns a vector of all inserted facts. Otherwise, returns a vector of maps containing all the matches for the given rule.
When called with just a session, returns a vector of all inserted facts. Otherwise, returns a vector of maps containing all the matches for the given rule.
(reset! new-session)
Mutates the session from a :then or :then-finally block.
Mutates the session from a :then or :then-finally block.
(retract session id attr)
Retracts the fact with the given id + attr combo.
Retracts the fact with the given id + attr combo.
(retract! id attr)
Equivalent to:
(o/reset! (o/retract o/session id attr))
Equivalent to: (o/reset! (o/retract o/*session* id attr))
(ruleset rules)
Returns a vector of rules after transforming the given map.
Returns a vector of rules after transforming the given map.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close