Prolog 列表问题
我正在使用 Flex,那里有一个名为 University 的框架,它有大约 100 个实例。我想将它们存储在一个列表中,该列表是 Prolog 而不是 Ksl 的一部分,并执行搜索操作。例如。该列表应仅包含位于美国的大学。谢谢 :)
I am working with flex and there I have a frame called university and it has about 100 instances. I would like to store them in a list which is part of Prolog not Ksl and perform search operations. eg. the list should contain only those universities whose location is USA. thanks :)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
要将数据存储在 Prolog 中,通常将其添加到事实数据库中:
然后您可以自由地使用 Prolog 的内置搜索来实现谓词,或者使用它通过
setof/3
为您提供事实列表code> 或findall/3
,例如:您当然可以让
university
事实携带更多数据并使用它来过滤:这些是非常基本的示例。恐怕您可能需要花一些时间阅读 Prolog 教程才能进一步了解。听起来您需要对这种语言有更强的掌握才能完成您的作业,这确实与您所知道的任何其他语言不同。
To store data in Prolog, you generally add it to the fact database:
Then you have the freedom to either implement your predicates with Prolog's built in search, or use it to give you a list of facts with
setof/3
orfindall/3
, such as:You can certainly make
university
facts carry more data and use that to filter:These are very rudimentary examples. I'm afraid you are probably going to have to spend some time going through a Prolog tutorial to get further. It sounds like you will need a stronger command of this language to complete your assignment, which really is nothing like any other language you know.