====== Add ====== {{tag>math arithmetic}} ===== Description ===== Multiple uses for plus **Source**: The Art of Prolog ===== Download ===== Program source code: {{prolog:pllib:add.pl}} ===== Listing ===== /* myplus(X,Y,Z) :- The sum of the numbers X and Y is Z. */ myplus(X,Y,Z) :- nonvar(X), nonvar(Y), Z is X + Y. myplus(X,Y,Z) :- nonvar(X), nonvar(Z), Y is Z - X. myplus(X,Y,Z) :- nonvar(Y), nonvar(Z), X is Z - Y. % Program 10.1 Multiple uses for plus ===== Comments =====