【问题标题】:Testing for presence in a multifield - CLIPS测试多场中的存在 - CLIPS
【发布时间】:2017-12-24 05:10:36
【问题描述】:

我想向规则的 LHS 添加一个条件,用于测试某个符号是否出现在模板的多槽某处。

例如,在下面的代码中,我想用任何表达式替换注释。

(deftemplate foo
(slot field
    (type STRING)
   )
(multislot multifield
    (type INTEGER)
  )
)

(deftemplate bar
(slot field
   (type INT)
  )
)

(defrule rule
(foo (field ?f1) (multifield $?mf1))
(bar (field ?f2))
; IF f2 IS AN ELEMENT OF mf1
=>
(assert (relation f1 f2))
)

这里的语法是什么?

【问题讨论】:

    标签: clips expert-system


    【解决方案1】:

    我需要使用member$ 函数!

    (test (member$ ?f2 ?mf1))
    

    【讨论】:

      猜你喜欢
      • 2022-11-29
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多