📄 misclns4.exp
字号:
TRUECLIPS> (batch "misclns4.bat")TRUECLIPS> (clear) ;; Case 1CLIPS> (defmodule A (export ?ALL))CLIPS> (deftemplate A::foo)CLIPS> (defmodule MAIN (import A ?ALL) (export ?ALL))CLIPS> (defmodule B (import MAIN ?ALL))CLIPS> (deftemplate B::foo)[CSTRCPSR3] Cannot define deftemplate foo because of an import/export conflict.ERROR:(deftemplate B::fooCLIPS> (clear) ;; Case 2CLIPS> (defmodule B)CLIPS> (defmodule B::foo)[PRNTUTIL2] Syntax Error: Check appropriate syntax for module specifier.ERROR:(defmodule B::fooCLIPS> (clear) ;; Case 3CLIPS> (defmodule ROOT (export ?ALL))CLIPS> (deftemplate A)CLIPS> (defmodule CHILD-1 (import ROOT ?ALL) (export ?ALL))CLIPS> (defmodule CHILD-2 (import ROOT ?ALL) (export ?ALL))CLIPS> (defmodule CHILD-3 (import CHILD-1 ?ALL) (import CHILD-2 ?ALL))CLIPS> (clear) ;; Case 4CLIPS> (defmodule d3 (export ?ALL))CLIPS> (deftemplate t1)CLIPS> (deftemplate t2)CLIPS> (defmodule d4 (export deftemplate t3 t4) (import d3 deftemplate t1))CLIPS> (clear) ;; Case 5CLIPS> (deftemplate foo (slot x) (slot y))CLIPS> (defrule bar (foo (x 3) (x 4) (y 3)) =>)[PRNTUTIL5] The slot x has already been parsed.ERROR:(defrule MAIN::bar (foo (x 3) (xCLIPS> (clear) ;; Case 6CLIPS> (deftemplate foo (slot x (type SYMBOL)))CLIPS> (defrule bar (foo (x ?x)) => (+ ?x 1))[RULECSTR3] Previous variable bindings of ?x caused the type restrictionsfor argument #1 of the expression (+ ?x 1)found in the rule's RHS to be violated.ERROR:(defrule MAIN::bar (foo (x ?x)) => (+ ?x 1))CLIPS> (defrule bar (foo (x ?x)) => (assert (yak (+ ?x 1))))[RULECSTR3] Previous variable bindings of ?x caused the type restrictionsfor argument #1 of the expression (+ ?x 1)found in the rule's RHS to be violated.ERROR:(defrule MAIN::bar (foo (x ?x)) => (assert (yak (+ ?x 1))))CLIPS> (clear) ;; Case 7CLIPS> (defmodule a)CLIPS> (assert (start))<Fact-0>CLIPS> (defrule foo (start) =>)CLIPS> (defmodule b)CLIPS> (assert (begin))<Fact-1>CLIPS> (defrule bar (begin) =>)CLIPS> (agenda)0 bar: f-1For a total of 1 activation.CLIPS> (agenda a)0 foo: f-0For a total of 1 activation.CLIPS> (agenda b)0 bar: f-1For a total of 1 activation.CLIPS> (agenda *)MAIN:a: 0 foo: f-0b: 0 bar: f-1For a total of 2 activations.CLIPS> (clear) ;; Case 8CLIPS> (defglobal ?*x* = 0)CLIPS> (defrule foo ?f <- (foo) => (bind ?*x* ?f))CLIPS> (assert (foo))<Fact-0>CLIPS> (run)CLIPS> (fact-index ?*x*)0CLIPS> (retract ?*x*)CLIPS> (fact-index ?*x*)-1CLIPS> (retract ?*x*)CLIPS> (clear) ;; Case 9CLIPS> (defmodule FOO (export ?ALL))CLIPS> (deftemplate FOO::foo)CLIPS> (defmodule BAR (export ?ALL) (import FOO ?ALL))CLIPS> (deftemplate BAR::foo)[CSTRCPSR3] Cannot define deftemplate foo because of an import/export conflict.ERROR:(deftemplate BAR::fooCLIPS> (clear) ;; Case 10CLIPS> (defmodule FOO (export ?ALL))CLIPS> (deftemplate FOO::foo)CLIPS> (defmodule BAR (export ?ALL))CLIPS> (deftemplate BAR::foo)CLIPS> (defmodule YAK (import FOO ?ALL) (import BAR ?ALL))[CSTRCPSR3] Cannot define defmodule YAK because of an import/export conflict caused by the deftemplate foo.ERROR:(defmodule YAK (import FOO ?ALL) (import BAR ?ALL))CLIPS> (clear) ;; Case 11CLIPS> (deftemplate set (multislot members))CLIPS> (deffacts stuff (set (members Q R S D T A B D)))CLIPS> (defrule remove-duplicates ?f <- (set (members $?b ?element $?m ?element $?e)) => (printout t ?b " " ?element " " ?m " " ?e crlf) (modify ?f (members ?b ?element ?m ?e)))CLIPS> (reset)CLIPS> (run)(Q R S) D (T A B) ()CLIPS> (facts)f-0 (initial-fact)f-2 (set (members Q R S D T A B))For a total of 2 facts.CLIPS> (clear) ;; Case 12CLIPS> (deftemplate set (multislot m1) (multislot m2))CLIPS> (deffacts stuff (set (m1 Q R S D T A B D X) (m2 Q R D A B D S X)))CLIPS> (defrule remove-duplicates ?f <- (set (m1 $?b1 ?element1 $?m1 ?element1 $?e1 X) (m2 $?b2 ?element2 $?m2 ?element2 $?e2 X)) => (printout t ?b1 " " ?element1 " " ?m1 " " ?e1 crlf) (printout t ?b2 " " ?element2 " " ?m2 " " ?e2 crlf) (modify ?f (m1 ?b1 ?element1 ?m1 ?e1) (m2 ?b2 ?element2 ?m2 ?e2)))CLIPS> (reset)CLIPS> (run)(Q R S) D (T A B) ()(Q R) D (A B) (S)CLIPS> (facts)f-0 (initial-fact)f-2 (set (m1 Q R S D T A B) (m2 Q R D A B S))For a total of 2 facts.CLIPS> (clear) ;; Case 13CLIPS> (deftemplate set (multislot m2))CLIPS> (deffacts stuff (set (m2 D D S X)))CLIPS> (defrule remove-duplicates ?f <- (set (m2 ?l2 $?m2 ?l2 $?e2 X)) => (printout t ?l2 " " ?m2 " " ?e2 crlf) (modify ?f (m2 ?l2 ?m2 ?e2)))CLIPS> (reset)CLIPS> (run)D () (S)CLIPS> (facts)f-0 (initial-fact)f-2 (set (m2 D S))For a total of 2 facts.CLIPS> (clear) ;; Case 14CLIPS> (defglobal ?*x* = 0)CLIPS> (defmodule MAIN (export ?ALL))CLIPS> (defmodule FOO (import MAIN defglobal ?ALL))CLIPS> (bind ?*x* 1)1CLIPS> ?*x*1CLIPS> (clear) ;; Case 15CLIPS> (defrule blah (m2 ?l2 $?m2 ?l2 $?e2 X) => (printout t ?l2 " " ?m2 " " ?e2 crlf))CLIPS> (assert (m2 D D S X))<Fact-0>CLIPS> (run)D () (S)CLIPS> (clear) ;; Case 16CLIPS> (deftemplate adder (multislot #-1) (multislot #-2))CLIPS> (deffacts adder-info (adder (#-1 1 0 1) (#-2 1 1)) (adder (#-1 1) (#-2 0)))CLIPS> (defrule another-bug (adder (#-1 $?n1 ?v) (#-2 $?n2 ~?v)) =>)CLIPS> (reset)CLIPS> (agenda)0 another-bug: f-2For a total of 1 activation.CLIPS> (clear) ;; Case 17CLIPS> (defmodule MAIN (export ?ALL))CLIPS> (defmodule A (import MAIN ?ALL) (export ?ALL))CLIPS> (deftemplate A::a (slot x))CLIPS> (defmodule B (import MAIN ?ALL) (import A ?ALL) (export ?ALL))CLIPS> (deftemplate B::b (slot y))CLIPS> (clear) ;; Case 18CLIPS> (defrule foo (declare (salience 4)) (x) (not (and (a) (b))) (y) =>)CLIPS> (defrule bar (declare (salience 3)) (x) (not (and (a) (b))) (test (< 5 3)) (y) =>)CLIPS> (defrule dog (declare (salience 2)) (x) (z) (not (and (a) (b))) (test (< 5 3)) (y) =>)CLIPS> (defrule yak (declare (salience 1)) (x) (z) (not (and (a) (b))) (y) =>)CLIPS> (reset)CLIPS> (agenda)CLIPS> (assert (x))<Fact-1>CLIPS> (agenda)CLIPS> (assert (y))<Fact-2>CLIPS> (agenda)4 foo: f-1,,f-2For a total of 1 activation.CLIPS> (assert (z))<Fact-3>CLIPS> (agenda)4 foo: f-1,,f-21 yak: f-1,f-3,,f-2For a total of 2 activations.CLIPS> (assert (a))<Fact-4>CLIPS> (agenda)4 foo: f-1,,f-21 yak: f-1,f-3,,f-2For a total of 2 activations.CLIPS> (assert (b))<Fact-5>CLIPS> (agenda)CLIPS> (clear) ;; Case 19CLIPS> (assert (foo))<Fact-0>CLIPS> (defmodule BAR)CLIPS> (assert (bar))<Fact-1>CLIPS> (save-facts bug.tmp)TRUECLIPS> (bsave bug.bin)TRUECLIPS> (bload bug.bin)TRUECLIPS> (load-facts bug.tmp) [FACTRHS1] Template bar does not exist for assert.Function load-facts encountered an errorFALSECLIPS> (facts)CLIPS> (clear) ;; Case 20CLIPS> (defrule foo1 (declare (salience 10)) =>)CLIPS> (defrule foo2 (declare (auto-focus TRUE)) =>)CLIPS> (defrule foo3 (declare (auto-focus TRUE) (salience 10)) =>)CLIPS> (defrule foo4 (declare (salience 10) (auto-focus TRUE)) =>)CLIPS> (ppdefrule foo1)(defrule MAIN::foo1 (declare (salience 10)) =>)CLIPS> (ppdefrule foo2)(defrule MAIN::foo2 (declare (auto-focus TRUE)) =>)CLIPS> (ppdefrule foo3)(defrule MAIN::foo3 (declare (auto-focus TRUE) (salience 10)) =>)CLIPS> (ppdefrule foo4)(defrule MAIN::foo4 (declare (salience 10) (auto-focus TRUE)) =>)CLIPS> (clear) ; watching specific itemsCLIPS> (unwatch all)CLIPS> (defglobal ?*foo* = 1)CLIPS> (defglobal ?*bar* = 2)CLIPS> (deftemplate foo)CLIPS> (deftemplate bar)CLIPS> (defrule foo (foo) => (assert (bar)))CLIPS> (defrule bar (bar) =>)CLIPS> (watch rules foo)CLIPS> (watch globals foo)CLIPS> (watch facts foo)CLIPS> (watch activations foo)CLIPS> (watch rules yak)[ARGACCES5] Function watch expected argument #2 to be of type defruleCLIPS> (watch globals yak)[ARGACCES5] Function watch expected argument #2 to be of type defglobalCLIPS> (watch facts yak)[ARGACCES5] Function watch expected argument #2 to be of type deftemplateCLIPS> (watch activations yak)[ARGACCES5] Function watch expected argument #2 to be of type defruleCLIPS> (watch compilations foo)[ARGACCES4] Function watch expected exactly 1 argument(s)CLIPS> (watch statistics foo)[ARGACCES4] Function watch expected exactly 1 argument(s)CLIPS> (watch focus foo)[ARGACCES4] Function watch expected exactly 1 argument(s)CLIPS> (reset):== ?*foo* ==> 1 <== 1CLIPS> (bind ?*foo* 3):== ?*foo* ==> 3 <== 13CLIPS> (bind ?*bar* 4)4CLIPS> (assert (foo))==> f-1 (foo)==> Activation 0 foo: f-1<Fact-1>CLIPS> (run)FIRE 1 foo: f-1CLIPS> (list-watch-items)facts = offinstances = offslots = offrules = offactivations = offmessages = offmessage-handlers = offgeneric-functions = offmethods = offdeffunctions = offcompilations = offstatistics = offglobals = offfocus = offCLIPS> (list-watch-items globals)globals = offMAIN: foo = on bar = offCLIPS> (list-watch-items facts)facts = offMAIN: initial-fact = off foo = on bar = offCLIPS> (list-watch-items rules)rules = offMAIN: foo = on bar = offCLIPS> (list-watch-items activations)activations = offMAIN: foo = on bar = offCLIPS> (list-watch-items compilations)compilations = offCLIPS> (list-watch-items statistics)statistics = offCLIPS> (list-watch-items focus)focus = offCLIPS> (unwatch all)CLIPS> (list-watch-items)facts = offinstances = offslots = offrules = offactivations = offmessages = offmessage-handlers = offgeneric-functions = offmethods = offdeffunctions = offcompilations = offstatistics = offglobals = offfocus = offCLIPS> (list-watch-items globals)globals = offMAIN: foo = off bar = offCLIPS> (list-watch-items facts)facts = offMAIN: initial-fact = off foo = off bar = offCLIPS> (list-watch-items rules)rules = offMAIN: foo = off bar = offCLIPS> (list-watch-items activations)activations = offMAIN: foo = off bar = offCLIPS> (list-watch-items compilations)compilations = offCLIPS> (list-watch-items statistics)statistics = offCLIPS> (list-watch-items focus)focus = offCLIPS> (dribble-off)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -