📄 guoqi.txt
字号:
;我在学习clips,所以来练习一下,以下代码实现了基本功能
(deftemplate stationcolors
(slot station (type STRING) (default ?DERIVE))
(multislot colors (type SYMBOL) (default ?DERIVE))
)
(deffacts stationcolors_list
(stationcolors (station "United States ") (colors red white blue))
(stationcolors (station "Belgium ") (colors black yellow red))
(stationcolors (station "Poland ") (colors white red))
(stationcolors (station "Monaco ") (colors white red))
(stationcolors (station "Sweden ") (colors yellow blue))
(stationcolors (station "Panama ") (colors red white blue))
(stationcolors (station "Jamaica ") (colors black yellow green))
(stationcolors (station "Colombia ") (colors yellow blue red))
(stationcolors (station "Italy ") (colors green white red))
(stationcolors (station "Ireland ") (colors green white orange))
(stationcolors (station "Greece ") (colors blue white))
(stationcolors (station "Botswans ") (colors blue white black))
)
(defrule startup
=>
(printout t "Please input a color : " )
(assert (color (read) ) )
)
(defrule check_color
(color ?color-read)
(stationcolors (station ?station) (colors $?colors))
=>
(bind ?lenColors (length ?colors))
(loop-for-count (?count1 1 ?lenColors) do
( if (eq ?color-read (nth$ ?count1 ?colors)) then
(printout t ?station " : " ?colors crlf )
)
)
)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -