This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-01-08
Channels
- # alda (1)
- # announcements (18)
- # babashka (101)
- # beginners (110)
- # calva (17)
- # cider (53)
- # clara (18)
- # clj-kondo (26)
- # cljdoc (6)
- # clojure (152)
- # clojure-europe (9)
- # clojure-portugal (4)
- # clojure-spec (20)
- # clojure-survey (7)
- # clojure-sweden (10)
- # clojure-uk (10)
- # clojured (1)
- # clojurescript (29)
- # core-async (7)
- # cursive (4)
- # datomic (11)
- # defnpodcast (2)
- # dirac (1)
- # emacs (13)
- # events (2)
- # figwheel-main (1)
- # fulcro (1)
- # jobs (14)
- # jobs-discuss (17)
- # leiningen (2)
- # malli (1)
- # off-topic (74)
- # overtone (1)
- # pedestal (4)
- # planck (2)
- # re-frame (7)
- # reitit (4)
- # remote-jobs (4)
- # shadow-cljs (78)
- # slack-help (3)
- # spacemacs (56)
- # test-check (3)
- # tools-deps (6)
is it possible to remove a rule from a session before firing it? I say that because I have a namespace with 10 rules and I want to run 9 of them. I would prefer to insert all the namespace and remove the single one
@iagwanderson, Currently there is no way to add/remove rules from the rulebase after the session has been created
@iagwanderson as I think you already know you can pass a collection of rules to make a session too.
You can list rule names in a vector in a var as well with :production-seq metadata. But still doesn’t help you. You can do dynamic stuff to make session to if you use the clara.rules.compiler/mk-session* which is a fn instead of macro
Doing that you could do some manual dynamic stuff with clj ns-publics where you removed the rules you didn’t want.
Or depending on what you’re doing. You could comment out your rule you don’t want and reload ensuring the ns has the old var removed. Hah.
hah.. this option is not possible here 😕 but I will try the dynamic one later. This is more a convenience than a requirement right now
do you think this functionality would be welcome to clara.core? I can try to implement it as a side project here
I'm making a real investment in this library in my project, so I wish to learn the internals better some time 😃
@iagwanderson it seems reasonable to think there could be support for ignoring certain rules. mk-session supports options so it could be added there perhaps. Or maybe rules could just be marked with metadata when wanting something like this.
I was thinking in this API:
(defrecord Values [id])
(defrule testing->include
[?value <- Values [v] (= ?id (:id v))]
=>
(println "INCLUDING!!! " ?value))
(defrule testing->exclude
[?value <- Values [v] (= ?id (:id v))]
=>
(println "EXCLUDING!!! " ?value))
(def session-without (rl/mk-session 'clara.rules.compiler/testing->include
'clara.rules.compiler/testing->exclude
:blacklist ['clara.rules.compiler/testing->exclude]))