片段不打印什么

0

的问题

我尝试写下代码中的剪辑,用于学校的项目(虽然我不明白为什么大赦国际在这一语言):

(deftemplate blood
    (slot bt)
    (multislot acc))
(deffacts acceptance
    (blood (bt 0) (acc 0 0))
    (blood (bt A) (acc 0 A))
    (blood (bt B) (acc 0 B))
    (blood (bt AB) (acc 0 A B AB)))
(defrule reading-input
=>
    (printout  t "Bloodtype of patient? ")
    (assert (patient (read)))
    (printout  t "Bloodtype of donor? ")
    (assert (donor (read))))
(defrule check-acceptance
    (patient ?patient)
    (donor ?donor)
    (blood (bt ?bt1) (acc ?acc1))
    (test (member$ ?donor ?acc1))
    =>
    (printout t "Transfusion is safe" crlf))

由于某些原因,它不打印什么投入 AA 或其他任何东西。 我也试过这个 if then else 发言,但同样的结果。

[prev code]
(blood (bt ?bt1) (acc ?acc1))
=>
(if (eq ?patient ?bt1)
then
(printout t ?bt1)
else
(printout t ?donor)))

这个想法是编写一个程序,是否打印输血安全或没有。

clips member testing
2021-11-23 18:37:11
1

最好的答案

0

修改你的 模式,使 bt 槽被限制到血型的患者和改变 acc1 到multifield变量,以便它将结合到的所有价值观在 行政协调会 的插槽

(defrule check-acceptance
   (patient ?patient)
   (donor ?donor)
   (blood (bt ?patient) (acc $?acc1))
   (test (member$ ?donor ?acc1))
   =>
   (printout t "Transfusion is safe" crlf))
2021-11-24 02:52:35

其他语言

此页面有其他语言版本

Русский
..................................................................................................................
Italiano
..................................................................................................................
Polski
..................................................................................................................
Română
..................................................................................................................
한국어
..................................................................................................................
हिन्दी
..................................................................................................................
Français
..................................................................................................................
Türk
..................................................................................................................
Česk
..................................................................................................................
Português
..................................................................................................................
ไทย
..................................................................................................................
Español
..................................................................................................................
Slovenský
..................................................................................................................