(remove-rule session rule-name)

Removes a rule from the given session.

Source

(defn remove-rule "Removes a rule from the given session." [session rule-name] (if-let [node-id (get-in session [:rule-name->node-id rule-name])] (-> (loop [session session node-id node-id] (if node-id (let [node (get-in session [:beta-nodes node-id]) session (update session :beta-nodes dissoc node-id)] (if (instance? JoinNode node) (-> session (update-in (:alpha-node-path node) (fn [alpha-node] (update alpha-node :successors (fn [successors] (vec (remove (fn* [p1__43219#] (= p1__43219# node-id)) successors)))))) (recur (:parent-id node))) (recur session (:parent-id node)))) session)) (update :rule-name->node-id dissoc rule-name) (update :node-id->rule-name dissoc node-id)) (throw (ex-info (str rule-name " does not exist in session") {}))))