📄 misclns1.exp
字号:
TRUECLIPS> (batch "misclns1.bat")TRUECLIPS> (clear) ; Test Begin CLIPS> (defglobal ?*constraint-salience* = 0)CLIPS> (defrule bar (declare (salience ?*constraint-salience*)) ?f <- (x ?y&?x) => (retract ?ins))[ANALYSIS4] Variable ?x was referenced in CE #1 field #1 before being defined.ERROR:(defrule MAIN::bar (declare (salience ?*constraint-salience*)) ?f <- (x ?y&?x) => (retract ?ins))CLIPS> (clear) ; Test BeginCLIPS> (defrule foo (declare (salience ?*my-salience*)) =>)[GLOBLDEF1] Global variable ?*my-salience* is unbound.[AGENDA3] This error occurred while evaluating the salience for rule foo.ERROR:(defrule MAIN::foo (declare (salience ?*my-salience*CLIPS> (clear) ; Test BeginCLIPS> (deftemplate status (field parent))CLIPS> (deffacts initial-positions (status (parent nil)))CLIPS> (defrule move-alone ?node <- (status (parent nil)) => (duplicate ?node (parent ?node)))CLIPS> (clear) ; Test BeginCLIPS> (defclass A (is-a USER) (role concrete) (pattern-match reactive))CLIPS> (deffacts bar (a))CLIPS> (definstances bar (a of A))CLIPS> (defrule foo1 (logical (a)) => (assert (b)))CLIPS> (defrule foo2 (logical (a)) => (make-instance [b] of A))CLIPS> (defrule foo3 (logical (object (name [a]))) => (assert (c)))CLIPS> (defrule foo4 (logical (object (name [a]))) => (make-instance [c] of A))CLIPS> (reset)CLIPS> (run)CLIPS> (dependents 1)[b],f-2CLIPS> (dependents 2)NoneCLIPS> (dependents 3)NoneCLIPS> (dependents [a])[c],f-3CLIPS> (dependents [b])NoneCLIPS> (dependents [c])NoneCLIPS> (dependencies 1)NoneCLIPS> (dependencies 2)f-1CLIPS> (dependencies 3)[a]CLIPS> (dependencies [a])NoneCLIPS> (dependencies [b])f-1CLIPS> (dependencies [c])[a]CLIPS> (clear) ; Test BeginCLIPS> (deftemplate yak (multifield x (type SYMBOL) (cardinality 3 5)))CLIPS> (assert (yak (x a b c)))<Fact-0>CLIPS> (assert (yak (x a b 1)))[CSTRNCHK1] A literal slot value found in the assert commanddoes not match the allowed types for slot x.CLIPS> (assert (yak (x 1 b 1)))[CSTRNCHK1] A literal slot value found in the assert commanddoes not match the allowed types for slot x.CLIPS> (assert (yak (x a b)))[CSTRNCHK1] Literal slot values found in the assert commanddoes not satisfy the cardinality restrictions for slot x.CLIPS> (assert (yak (x a b c d e f)))[CSTRNCHK1] Literal slot values found in the assert commanddoes not satisfy the cardinality restrictions for slot x.CLIPS> (assert (yak (x a b c d e f g 1)))[CSTRNCHK1] Literal slot values found in the assert commanddoes not satisfy the cardinality restrictions for slot x.CLIPS> (clear) ; Test BeginCLIPS> (defrule foo (x ? ? ? ? ?) =>)CLIPS> (defrule bar (x ? ? ? ? ?x&:(> ?x 3)) =>)CLIPS> (deffacts yak (x a a a a abc))CLIPS> (reset)[ARGACCES5] Function > expected argument #1 to be of type integer or float[FACTMCH1] This error occurred in the fact pattern network Currently active fact: (x a a a a abc) Problem resides in field #5 Of pattern #1 in rule(s): barCLIPS> (clear)CLIPS> (defrule foo (x ?) =>)CLIPS> (defrule bar (x ?x&:(> ?x 3)) =>)CLIPS> (deffacts yak (x abc))CLIPS> (reset)[ARGACCES5] Function > expected argument #1 to be of type integer or float[FACTMCH1] This error occurred in the fact pattern network Currently active fact: (x abc) Problem resides in field #1 Of pattern #1 in rule(s): barCLIPS> (clear)CLIPS> (deftemplate x (field q) (field r) (field s) (field t))CLIPS> (defrule foo (x (t ?)) =>)CLIPS> (defrule bar (x (t ?x&:(> ?x 3))) =>)CLIPS> (deffacts yak (x (t abc)))CLIPS> (reset)[ARGACCES5] Function > expected argument #1 to be of type integer or float[FACTMCH1] This error occurred in the fact pattern network Currently active fact: (x (q nil) (r nil) (s nil) (t abc)) Problem resides in slot t Of pattern #1 in rule(s): barCLIPS> (clear) ; Test BeginCLIPS> (deffunction positive-slope (?x1 ?y1 ?x2 ?y2) (< 0 (/ (- ?y2 ?y1) (- ?x2 ?x1))))CLIPS> (defrule example-2 (point ?a ?x1 ?y1) (point ?b ?x2 ?y2) (test (> ?b ?a)) (test (positive-slope ?x1 ?y1 ?x2 ?y2)) =>)CLIPS> (assert (point 1 4.0 7.0) (point 2 5.0 9.0))<Fact-1>CLIPS> (clear) ; Test BeginCLIPS> (deftemplate A (field foo (type INTEGER)))CLIPS> (defrule foo (A (foo ?y&:(< ?y 3))) =>)CLIPS> (clear) ; Test BeginCLIPS> (deftemplate A (field grid-x) (field max) (field min-xy) (field max-xy))CLIPS> (defrule p327 (A (min-xy ?min) (max-xy ?max)) (A (grid-x ?gx&:(and (>= ?gx ?min) (> ?gx ?max)))) (A (max ?hmax&:(and (>= ?hmax ?gx) (> ?hmax ?min)))) =>)CLIPS> (clear) ; Test BeginCLIPS> (deftemplate foo (field x (type INTEGER)) (field y (type STRING)) (field z (type FLOAT)))CLIPS> (deftemplate bar (field x (type INTEGER)) (field y (type STRING)) (field z (type FLOAT)))CLIPS> (defrule bad-1 (foo (x ?x) (y ?x)) =>)[RULECSTR1] Variable ?x in CE #1 slot yhas constraint conflicts which make the pattern unmatchable.ERROR:(defrule MAIN::bad-1 (foo (x ?x) (y ?x)) =>)CLIPS> (defrule bad-2 (foo (x ?x)) (bar (y ?x)) =>)[RULECSTR1] Variable ?x in CE #2 slot yhas constraint conflicts which make the pattern unmatchable.ERROR:(defrule MAIN::bad-2 (foo (x ?x)) (bar (y ?x)) =>)CLIPS> (defrule bad-3 (foo (x ?x) (y ?y)) (bar (z ?x | ?y)) =>)[RULECSTR1] Pattern #2 slot zhas constraint conflicts which make the pattern unmatchable.ERROR:(defrule MAIN::bad-3 (foo (x ?x) (y ?y)) (bar (z ?x|?y)) =>)CLIPS> (clear) ; Test BeginCLIPS> (defrule fin (foo ?d) (test (> ?d 2)) (foo ?l&~?d) =>)CLIPS> (clear) ; Test BeginCLIPS> (deftemplate foo1 (field x (cardinality 3 4)))[CSTRNPSR5] The cardinality attribute can only be used with multifield slots.ERROR:(deftemplate MAIN::foo1 (field x (cardinalityCLIPS> (deftemplate foo2 (multifield x (cardinality 3.0 4)))[PRNTUTIL2] Syntax Error: Check appropriate syntax for cardinality attribute.ERROR:(deftemplate MAIN::foo2 (multifield x (cardinality 3.0CLIPS> (deftemplate foo3 (multifield x (cardinality 6 4)))[CSTRNPSR2] Minimum cardinality value must be less thanor equal to the maximum cardinality valueERROR:(deftemplate MAIN::foo3 (multifield x (cardinality 6 4)CLIPS> (clear) ; Test BeginCLIPS> (defrule foo (blah $?x ?y&red $?z) => (printout t ?x " | " ?y " | " ?z crlf))CLIPS> (defrule bar (yech $?x $?y) => (printout t ?x " | " ?y crlf))CLIPS> (assert (blah red) (blah red red) (blah a red b) (blah a red red b))<Fact-3>CLIPS> (assert (yech) (yech 1 2) (yech 1 2 3))<Fact-6>CLIPS> (run)() | (1 2 3)(1) | (2 3)(1 2) | (3)(1 2 3) | ()() | (1 2)(1) | (2)(1 2) | ()() | ()(a) | red | (red b)(a red) | red | (b)(a) | red | (b)() | red | (red)(red) | red | ()() | red | ()CLIPS> (clear)CLIPS> (dribble-off)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -