CLIPS:断言任意长度的事实

发布于 2024-10-06 12:11:44 字数 192 浏览 0 评论 0原文

我的系统中的一个示例事实可能是(trip 4 1330 650 boston Chicago ... los_angeles),最后添加了任意数量的城市。我知道我可以使用多字段通配符 ($?) 匹配任意长度,但如何断言具有任意长度的事实?我想要做的是匹配上面表格中的一个事实,然后在其末尾附加另一个城市。可以这样做吗?

An example fact in my system could be (trip 4 1330 650 boston chicago ... los_angeles) with any number of cities tacked on at the end. I know I can match arbitrary lengths using the multifield wildcard ($?), but how can I assert a fact with an arbitrary length? What I want to do is match to one of the facts in the form above, and then append another city to the end of it. Is it possible to do this?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

摇划花蜜的午后 2024-10-13 12:11:44

是的,这是可能的。您可以使用 $? 匹配事实的 0 个或多个部分。要在 RHS 中使用它,您可以使用 $?variable_name 将其分配给变量。

要将另一个城市附加到末尾,您可以将您的行程事实与 (trip ?arg1 ?arg2 ?arg3 $?cities) 相匹配,并在末尾断言一个新的行程事实:(行程?arg1?arg2?arg3 $?cities new_city)

Yes it is possible. You can match 0 or more parts of a fact using $?. To use it in the RHS you can assign it to a variable using $?variable_name.

To append another city onto the end, you can match your trip fact with (trip ?arg1 ?arg2 ?arg3 $?cities) and assert a new trip fact with the city on the end: (trip ?arg1 ?arg2 ?arg3 $?cities new_city).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文