I am new to Prolog and am experimenting around with some stuff, in particular i’m thinking about how to do a certain thing in prolog. I am aware of facts and rules, facts being something of the sort
specialCustomer(x). //person x is a specialcustomer
and rules:
totalSpend(x,500) :- specialCustomer(x). //if x spends 500, he is a special customer
Would this fact and rule be valid in prolog? Is the rule wrong? How would i be able to query this through prolog? As in would a call of
totalSpend(bob,500).
be a valid call?
sorry if i am answering my own question, i just seem to be a bit…well confused!
If you want to say that Bob, Jim and everyone who spends more than 500 are special customers, then define some people’s spending, you would define it as follows:
Then you would query it as follows: