Hello to all, i would like to define a list(List of Bank Customer) from predicate and process the list using some rule.
For instance, i have the customer predicate like this
customer(peter,bank(maybank),customertype(personal),
citizen(malaysian),age(62),credit(50000),
income(4500),property(car),bankemployee(no) ).
customer(mary,bank(maybank),customertype(vip),
citizen(others),age(45),credit(20000),
income(5000),property(house),bankemployee(yes) ).
I want to add them into a list programmatically inside the source code.
Then, i would like to evaluate the list whether element in the list fulfill a particular rule. Example: Whether the first item loan accept, whether the second item(customer) has lower interest.
isloanaccept(Name,Guarantor,LoanType,LoanAmount,LoanTenure)
:- customer(Name,bank(_),customertype(_),
citizen(Ci),age(Age),credit(C),
income(I),property(_),bankemployee(_)),
Ci == 'malaysian',
Age >= 18,
C > 500,
I > (LoanAmount / LoanTenure) / 12;
isguarantor(Guarantor,Name),
ispersonalloan(LoanType,LoanAmount,LoanTenure);
ishouseloan(LoanType,LoanAmount,LoanTenure);
isbusinessloan(LoanType,LoanAmount,LoanTenure);
iscarloan(LoanType,LoanAmount,LoanTenure).
issenioroffer(Name,LoanAmount,LoanTenure)
:- isloanaccept(Name,LoanAmount,LoanTenure),
isseniorcitizen(Name).
I need to program them more high level.
Please help.
Thanks.