TRUE CLIPS> (batch "exists.bat") TRUE CLIPS> (clear) ; Test exists CLIPS> (watch activations) CLIPS> (watch facts) CLIPS> (defrule test (exists (a ?)) =>) CLIPS> (reset) CLIPS> (assert (a 1)) ==> f-1 (a 1) ==> Activation 0 test: * CLIPS> (assert (a 2)) ==> f-2 (a 2) CLIPS> (assert (a 3)) ==> f-3 (a 3) CLIPS> (retract 1) <== f-1 (a 1) CLIPS> (retract 3) <== f-3 (a 3) CLIPS> (retract 2) <== f-2 (a 2) <== Activation 0 test: * CLIPS> (assert (a 4)) ==> f-4 (a 4) ==> Activation 0 test: * CLIPS> (clear) CLIPS> (defrule test (a ?x) (exists (b ?x ?)) =>) CLIPS> (reset) CLIPS> (assert (b 1 1)) ==> f-1 (b 1 1) CLIPS> (assert (b 1 2)) ==> f-2 (b 1 2) CLIPS> (assert (a 1)) ==> f-3 (a 1) ==> Activation 0 test: f-3,* CLIPS> (assert (a 2)) ==> f-4 (a 2) CLIPS> (retract 1) <== f-1 (b 1 1) CLIPS> (retract 2) <== f-2 (b 1 2) <== Activation 0 test: f-3,* CLIPS> (assert (b 2 2)) ==> f-5 (b 2 2) ==> Activation 0 test: f-4,* CLIPS> (assert (b 1 2)) ==> f-6 (b 1 2) ==> Activation 0 test: f-3,* CLIPS> (assert (b 2 3)) ==> f-7 (b 2 3) CLIPS> (assert (b 1 3)) ==> f-8 (b 1 3) CLIPS> (retract 7) <== f-7 (b 2 3) CLIPS> (retract 5) <== f-5 (b 2 2) <== Activation 0 test: f-4,* CLIPS> (retract 3) <== f-3 (a 1) <== Activation 0 test: f-3,* CLIPS> (unwatch facts) CLIPS> (unwatch activations) CLIPS> (clear) CLIPS> (defrule foo (a) (exists (a) (a)) =>) CLIPS> (reset) CLIPS> (assert (a)) CLIPS> (agenda) 0 foo: f-1,* For a total of 1 activation. CLIPS> (retract 1) CLIPS> (agenda) CLIPS> (clear) ; 6.3 Issue CLIPS> (unwatch all) CLIPS> (defrule detect (b ?b) (exists (a)) (test (eq ?b 2)) => (printout t "Rule Fired" crlf)) CLIPS> (assert (a)) CLIPS> (assert (b 1)) CLIPS> (run) CLIPS> (reset) CLIPS> (assert (b 1)) CLIPS> (assert (a)) CLIPS> (run) CLIPS> (reset) CLIPS> (assert (a)) CLIPS> (assert (b 2)) CLIPS> (run) Rule Fired CLIPS> (reset) CLIPS> (assert (b 2)) CLIPS> (assert (a)) CLIPS> (run) Rule Fired CLIPS> (clear) ; 6.3 Issue CLIPS> (deffacts xy (SAD T 1 T07 "12345678")) CLIPS> (defrule x (exists (SAD T ?ix T07 ?str) (test (>= (str-length ?str) 0))) (test (= 1 1)) =>) CLIPS> (reset) CLIPS> (agenda) 0 x: * For a total of 1 activation. CLIPS> (clear) CLIPS> (dribble-off)