📄 factsav.exp
字号:
TRUECLIPS> (batch "factsav.bat")TRUECLIPS> (clear) ; Test error conditions for load/save factsCLIPS> (save-facts)[ARGACCES4] Function save-facts expected at least 1 argument(s)CLIPS> (save-facts 7)[ARGACCES5] Function save-facts expected argument #1 to be of type symbol or stringCLIPS> (save-facts blah.tmp 7)[ARGACCES5] Function save-facts expected argument #2 to be of type symbolCLIPS> (save-facts blah.tmp hello)[ARGACCES5] Function save-facts expected argument #2 to be of type symbol with value local or visibleFALSECLIPS> (save-facts blah.tmp local bogus)[ARGACCES5] Function save-facts expected argument #3 to be of type local deftemplate nameFALSECLIPS> (remove blah.tmp)TRUECLIPS> (save-facts blah.tmp)TRUECLIPS> (load-facts)[ARGACCES4] Function load-facts expected exactly 1 argument(s)CLIPS> (load-facts 7)[ARGACCES5] Function load-facts expected argument #1 to be of type symbol or stringCLIPS> (load-facts blah.tmp bogus)[ARGACCES4] Function load-facts expected exactly 1 argument(s)CLIPS> (remove blah.tmp)TRUECLIPS> (load-facts blah.tmp)[ARGACCES2] Function load-facts was unable to open file blah.tmp.FALSECLIPS> (clear) ; Test Saving and ReloadingCLIPS> (load factsav.clp)+%%+%%%+%%+TRUECLIPS> (reset)CLIPS> (set-current-module MAIN)MAINCLIPS> (assert (A (x 1)) (B (x 1)) (B (x 2)))<Fact-3>CLIPS> (set-current-module BAR)MAINCLIPS> (assert (D (x 2)) (C (x 1)) (D (x 1)) (E (x 1)))<Fact-7>CLIPS> (set-current-module WOZ)BARCLIPS> (assert (G (x 1)) (F (x 1)) (G (x 2)))<Fact-10>CLIPS> (set-current-module MAIN)WOZCLIPS> (facts *)f-0 (initial-fact)f-1 (A (x 1))f-2 (B (x 1))f-3 (B (x 2))f-4 (D (x 2))f-5 (C (x 1))f-6 (D (x 1))f-7 (E (x 1))f-8 (G (x 1))f-9 (F (x 1))f-10 (G (x 2))For a total of 11 facts.CLIPS> (facts)f-0 (initial-fact)f-1 (A (x 1))f-2 (B (x 1))f-3 (B (x 2))For a total of 4 facts.CLIPS> (save-facts fctsav1.out visible)TRUECLIPS> (save-facts fctsav2.out local A)TRUECLIPS> (set-current-module BAR)MAINCLIPS> (facts)f-1 (A (x 1))f-2 (B (x 1))f-3 (B (x 2))f-4 (D (x 2))f-5 (C (x 1))f-6 (D (x 1))f-7 (E (x 1))For a total of 7 facts.CLIPS> (save-facts fctsav3.out local C)TRUECLIPS> (save-facts fctsav4.out visible B E)TRUECLIPS> (set-current-module WOZ)BARCLIPS> (facts)f-7 (E (x 1))f-8 (G (x 1))f-9 (F (x 1))f-10 (G (x 2))For a total of 4 facts.CLIPS> (save-facts fctsav5.out local)TRUECLIPS> (save-facts fctsav6.out visible F G E)TRUECLIPS> (set-current-module FOO)WOZCLIPS> (facts)f-0 (initial-fact)f-1 (A (x 1))f-2 (B (x 1))f-3 (B (x 2))f-7 (E (x 1))f-9 (F (x 1))For a total of 6 facts.CLIPS> (save-facts fctsav7.out local)TRUECLIPS> (save-facts fctsav8.out visible)TRUECLIPS> (reset)CLIPS> (set-current-module MAIN)MAINCLIPS> (load-facts fctsav1.out)TRUECLIPS> (facts *)f-0 (initial-fact)f-1 (A (x 1))f-2 (B (x 1))f-3 (B (x 2))For a total of 4 facts.CLIPS> (retract *)CLIPS> (load-facts fctsav2.out)TRUECLIPS> (facts *)f-4 (A (x 1))For a total of 1 fact.CLIPS> (retract *)CLIPS> (load-facts fctsav3.out)[PRNTUTIL2] Syntax Error: Check appropriate syntax for RHS patterns.Function load-facts encountered an errorFALSECLIPS> (facts *)CLIPS> (retract *)CLIPS> (set-current-module BAR)MAINCLIPS> (load-facts fctsav3.out)TRUECLIPS> (facts *)f-5 (C (x 1))For a total of 1 fact.CLIPS> (retract *)CLIPS> (load-facts fctsav4.out)TRUECLIPS> (facts *)f-6 (B (x 1))f-7 (B (x 2))f-8 (E (x 1))For a total of 3 facts.CLIPS> (retract *)CLIPS> (set-current-module WOZ)BARCLIPS> (load-facts fctsav5.out)TRUECLIPS> (facts *)f-9 (G (x 1))f-10 (F (x 1))f-11 (G (x 2))For a total of 3 facts.CLIPS> (retract *)CLIPS> (load-facts fctsav6.out)TRUECLIPS> (facts *)f-12 (E (x 1))f-13 (G (x 1))f-14 (F (x 1))f-15 (G (x 2))For a total of 4 facts.CLIPS> (retract *)CLIPS> (set-current-module FOO)WOZCLIPS> (load-facts fctsav7.out)TRUECLIPS> (facts *)CLIPS> (retract *)CLIPS> (load-facts fctsav8.out)TRUECLIPS> (facts *)f-16 (initial-fact)f-17 (A (x 1))f-18 (B (x 1))f-19 (B (x 2))f-20 (E (x 1))f-21 (F (x 1))For a total of 6 facts.CLIPS> (retract *)CLIPS> (dribble-off)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -