我需要设计一个规则来测试贷款是否是汽车贷款。
carLoan(flexiCar,minLoanAmount(20000),maxTenure(12) ).
iscarloan(X, Y, Z) :- carLoan(X, Y >= minLoanAmount(20000), Z =<(maxTenure(12)) ).
iscarloan(X, 25000, 10).
我需要根据规则内部的事实测试结构的Y和Z变量。
如何实现?
感谢。
答案 0 :(得分:1)
iscarloan(X, Y, Z) :-
carLoan(X, minLoanAmount(MinLoan), maxTenure(MaxTenure)),
Y >= MinLoan,
Z =< MaxTenure.
你记得的是什么?
答案 1 :(得分:0)
carLoan(flexiCar, minLoanAmount(20000), maxTenure(12)).
iscarloan(X, Y, Z) :-
Y = minLoanAmount(MLA),
Z = maxTenure(MT),
MLAN is MLA,
MTN is MT,
MLAN >= 20000,
MTN =< 12.
iscarloan(X, 25000, 10).