Prolog 组合规则
我需要编写一条由子规则组成的规则。
知道如何实现这一目标吗?
isloanaccept(Name, LoanAmount, LoanTenure)
:- customer(Name, bank(_),customertype(_),
citizen(malaysian),age(Age),credit(C),
income(I),property(car|house)),
Age >= 18,
C > 500,
I > (LoanAmount / LoanTenure) / 12.
lowerinterest(Senior) :- isseniorcitizen(Senior).
例如,我需要检查客户类型。 如果客户类型是 VIP,则利息较低。 如果年龄超过60岁,利息会降低。
请帮忙。
谢谢。
i need to write a rule which consists of sub rule.
Any idea how to achieve this ?
isloanaccept(Name, LoanAmount, LoanTenure)
:- customer(Name, bank(_),customertype(_),
citizen(malaysian),age(Age),credit(C),
income(I),property(car|house)),
Age >= 18,
C > 500,
I > (LoanAmount / LoanTenure) / 12.
lowerinterest(Senior) :- isseniorcitizen(Senior).
For instance, i need to check the customer type .
If customer type is VIP, interest lower.
If age is above 60, interest lower.
Please help.
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
向
isloanaccept
添加额外的参数可能是最简单的方法。PS.:请尝试以这种方式格式化 Prolog 代码,这样会更容易阅读。
Adding an extra argument to
isloanaccept
is probably the easiest way.PS.: Please try to format Prolog code this way, that makes it a lot easier to read.
这就是我要做的:
That's what I would do: