是否可以从列表中创建谓词?
我使用 SWI-Prolog
我有这样的列表
[sunny,hot,high,weak,no]
,
[outlook,temperature,humidity,wind,play_tennis]
我想制作一个像
run(no, [outlook=sunny, temp=hot, humidity=high, wind=weak ]).
Is it possible? 这样的谓词吗?
I use SWI-Prolog
I have lists like this
[sunny,hot,high,weak,no]
and
[outlook,temperature,humidity,wind,play_tennis]
I want to make a predicate like
run(no, [outlook=sunny, temp=hot, humidity=high, wind=weak ]).
Is it possible?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
是的,但是您必须实现适当的机器学习算法(您的示例看起来与米切尔的机器学习书中找到的示例相同,这是一项家庭作业吗?)。
请注意,您可以使用
=..
运算符将列表转换为谓词,如果我误解了您原来的问题,这可能会对您有所帮助。换句话说,A=..[a,b,c]
将a(b,c)
绑定到A
Yes, but you're going to have to implement the appropriate machine learning algorithm (your example looks identical to the ones found in Mitchell's machine learning book, is this a homework assignment?).
Note that you can use the
=..
operator to turn a list into a predicate, which might help you if I've misunderstood your original question. In other words,A=..[a,b,c]
bindsa(b,c)
toA