14 lines
451 B
Prolog
14 lines
451 B
Prolog
/* facts */
|
|
set_height(dave, 180).
|
|
set_height(alice, 155).
|
|
set_height(bob, 176).
|
|
set_height(mary, 166).
|
|
set_height(phi, 166).
|
|
set_height(tom, 32).
|
|
|
|
/* rules */
|
|
taller_than(X, Y) :- set_height(X, XH), set_height(Y, YH), XH < YH.
|
|
smaller_than(X, Y) :- set_height(X, XH), set_height(Y, YH), XH > YH.
|
|
same_height(X, Y) :- set_height(X, XH), set_height(Y, YH), XH = YH.
|
|
size(X) :- set_height(X, XH), write(X), write(' is '), write(XH), write(' cm tall!').
|