📄 rulemisc.bat
字号:
(unwatch all)(clear) ; Test Thing #1(defrule rule-1 (foo $?b ?x) =>)(defrule rule-2 (foo $?y) =>)(clear) ; Test Thing #2(watch facts)(watch activations)(defrule foo (not (not (and (a) (b)))) =>)(defrule bar (not (and (a) (b))) =>)(reset)(assert (a))(assert (b))(unwatch all)(clear) ; Test Thing #3(reset)(defrule foo (initial-fact) (not (a)) =>)(defrule bar (initial-fact) =>)(agenda)(unwatch all)(clear) ; Test Thing #4(defrule foo (logical (exists (a ?) (b ?))) => (assert (q)))(reset)(assert (a 1) (b 1) (a 2) (b 2) (a 3))(run)(watch facts)(retract 1 2 3 4)(unwatch all)(clear) ; Test Thing #5(defrule rule-1 (a ?x) (not (b ?x)) =>)(reset)(assert (a 1) (a 2) (b 2))(run)(refresh rule-1)(agenda)(clear) ; Test Thing #6(reset)(watch facts)(watch activations)(defrule all-players-practiced (logical (forall (player ?name) (pitched ?name) (batted ?name))) => (assert (all-players-have-practiced)))(assert (player Gary) (pitched Gary) (batted Gary))(assert (pitched Brian) (player Brian) (batted Brian))(run)(retract 3)(unwatch all)(clear) ; Test Thing #7(defrule rule-1 (team ?x) (forall (player ?z ?x) (batted ?z) (pitched ?z)) =>)(matches rule-1)(assert (team Reds))(matches rule-1)(assert (player Gary Reds))(matches rule-1)(assert (batted Gary))(matches rule-1)(assert (pitched Gary))(matches rule-1)(clear) ; Test Thing #8 - Fact Addresses References(defrule theRule ?f <- (this) (that ?f) =>)(assert (that =(assert (this))))(agenda)(defrule theRule ?f <- (a) ?f <- (b) =>)(defrule theRule (a ?f) ?f <- (b) =>)(clear) ; Test Thing #9(deffacts start (rule-2))(defrule rule-1 (rule-2) (rule-2 green) =>)(defrule rule-2 (rule-2 $?) =>)(reset)(agenda)(clear) ; Test Thing #10(defrule foo (a ?) (b ?) (c ?) =>)(assert (a 1) (a 2) (b 1) (b 2) (c 1))(matches foo)(clear) ; Test Thing #11(defrule foo (exists (a ?x) (b ?x)) (exists (c ?x) (d ?x)) =>)(reset)(assert (a 1) (b 1) (c 2) (d 2))(matches foo)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -