I am teaching myself Prolog (using SWI on linux), and I am trying to learn basic arithmetic. Take a look at the example program below.
When I attempt to ask any of the following thee questions Prolog tells me the procedure total1/2 is undefined.
Question Statements:
total1('prawn crackers', COST).
total2('prawn crackers', 'fried rice',COST).
total3('spring roll', 'chow mien','boiled rice',COST).
Prolog Program:
dish('prawn crackers', 1).
dish('boiled rice',1).
dish('fried rice', 2).
dish('chow mein',3).
dish('chop suey',4).
dish('spring roll',2).
total1(X,T) :- dish(X,A) T is A.
total2(X,Y,T) :- dish(X,A), dish(Y,B) T is A + B.
total3(X,Y,Z,T) :- dish(X,A), dish(Y,B), dish(Z,C) T is A + B + c.