next up previous
Next: Expert Systems in Prolog Up: prolog Previous: Cut

Cut Example

part(a). part(b). part(c).

red(a). black(b).

color(P,red) :- red(P),!.
color(P,black) :- black(P),!.
color(P,unknown).

This finds a stored color or concludes the color is unknown. Derivations for color are prevented. Thus unknown is not reported for a or b.