CLIPS-自定义事实结构

一、自定义事实结构

1、自动声明一组事实,不必在顶层输入相同的声明信息,使用(reset)命令会删除事实表中所有事实,然后根据现有的自定义事实结构声明事实。

2、deffacts teacher "107 class teacher"中teacher为事实关健字,"107 classteacher"为事实名

3、f-0(initial-fact)为系统默认定义的自定义事实结构,关键字为initial-fact

启动时,CLIPS自动定义以下两个结构

(deftemplate initial-fact)

(deffacts initial-fact

(initial-fact))

二、操作

CLIPS> (reset)
CLIPS> (facts)
f-0(initial-fact)
For a total of 1 fact.
CLIPS> (deftemplate person
(slot name)
(slot age)
(slot sex))
CLIPS> (deffacts teacher "107 class teacher"
(person (name "wangli") (age 28) (sex male))
(person (name "zhouhui") (age 38) (sex female))
(person (name "liujun") (age 30)(sex male)))
CLIPS> (reset)
CLIPS> (facts)
f-0(initial-fact)
f-1(person (name "wangli") (age 28) (sex male))
f-2(person (name "zhouhui") (age 38) (sex female))
f-3(person (name "liujun") (age 30) (sex male))
For a total of 4 facts.
CLIPS>

你可能感兴趣的:(F#)