如何修改有序(非模板)事实,说n个值?
修改不起作用。我希望事实1是(Axyz)。
此外,如果我想更改事实1的第二个元素 c 说 g ,即新事实应该是(abgd)
是有一种方法使用修改?
摘要附在下面。
CLIPS> (assert (a b c d))
<Fact-1>
CLIPS> (bind ?s x y z)
(x y z)
CLIPS> (facts)
f-1 (a b c d)
For a total of 1 fact.
CLIPS> ?s
(x y z)
CLIPS> (modify 1 (implied ?s))
FALSE
CLIPS> (facts)
f-1 (a b c d)
For a total of 1 fact.
CLIPS>
modify is not working. I expected fact 1 to be (a x y z).
Further, if I want to change the second element c of the fact 1 to say g, i.e the new fact should be (a b g d)
is there a way using modify ?
Snippet attached below.
CLIPS> (assert (a b c d))
<Fact-1>
CLIPS> (bind ?s x y z)
(x y z)
CLIPS> (facts)
f-1 (a b c d)
For a total of 1 fact.
CLIPS> ?s
(x y z)
CLIPS> (modify 1 (implied ?s))
FALSE
CLIPS> (facts)
f-1 (a b c d)
For a total of 1 fact.
CLIPS>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
修改仅适用于模板事实。如果您使用有序事实,则需要进行缩回并断言:
使用替换$函数在多场值中替换值,然后再将其作为事实的一部分:
Modify only works with template facts. If you're using ordered facts, you need to do a retract and assert:
Use the replace$ function to replace values in a multifield value before asserting it as part of a fact: