Created
July 8, 2016 14:13
-
-
Save WilliamParker/c6be14cb249d55b6d2e3ff42500a9334 to your computer and use it in GitHub Desktop.
Demo of session immutatibility in clara-rules
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
clara.test-rules> (com/clear-session-cache!) | |
{} | |
clara.test-rules> (defrule first->second-rule | |
[First] | |
=> | |
(insert! (->Second))) | |
#'clara.test-rules/first->second-rule | |
clara.test-rules> (defquery second-query | |
[] | |
[Second]) | |
#'clara.test-rules/second-query | |
clara.test-rules> (def empty-session (mk-session [first->second-rule second-query])) | |
#'clara.test-rules/empty-session | |
clara.test-rules> (-> empty-session | |
(insert (->First)) | |
fire-rules | |
(query second-query)) | |
({}) | |
clara.test-rules> (query empty-session second-query) | |
() | |
clara.test-rules> (type (insert empty-session (->First))) | |
clara.rules.engine.LocalSession | |
clara.test-rules> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment