【发布时间】:2016-01-27 02:04:05
【问题描述】:
我正在努力正确评估多字段值的整数值。
我最终需要的是对仅包含整数的多槽进行模式匹配,并能够判断“列表”是否按升序排列。
到目前为止我所拥有的:
(defclass status
(is-a USER)
(role concrete)
(pattern-match reactive)
(multislot numbers
(create-accessor write)
(type INTEGER)
(range 1 ?VARIABLE)
(default 1)
)
)
(defrule asc
?st <- (object (is-a status) (numbers $?n))
(test (> (length ?n) 2))
(test (< (first$ ?n) (rest$ ?n)))
=>
(printout t "List " ?n " is ascending" crlf)
)
(make-instance of status (numbers 1 2 3))
我知道这可能不是扩展多槽并为 (
(first$ ?n)
不计算为整数。
我的问题是: 如何获取值列表的值并将其“解析”为整数? 其次,如何扩展这些值以使它们成为 (
【问题讨论】:
标签: clips expert-system