deletes from the database all clauses which head is unifiable with the argument.
retractall/1 deletes all clauses from the database which
head is unifiable with Head.
That means that retractall/1 can be defined as:
retractall(Head) :- retract((Head :- _)), fail.
retractall(_).
Head head of a clause
Assume that the database contains the clauses:
colour(blue).
colour(yellow).
colour(blue,yellow,green).
add(X,Y,Z) :- Z is X+Y.
f(a).
f(a) :- b.
| retractall(colour(X)). | Succeeds. The database contains now the clauses:
colour(blue,yellow,green). add(X,Y,Z) :- Z is X+Y. f(a). f(b) :- b. |
This predicate is not part of the ISO-Prolog Standard.