retractall/1
retractall(
+Head)
Removes every clause in module M whose head matches Head.
Head of a Prolog clause.
Head must be instantiated to a term that looks
like a call to a dynamic procedure.
For example, to retract all the clauses of foo/3
, you would write
| ?- retractall(foo(_,_,_)).
Head may be preceded by a M: prefix, in which case the clauses are retracted from module M instead of the calling module.
retractall/1
is useful for erasing all the clauses of a dynamic
procedure without forgetting that it is dynamic; abolish/1
will
not only erase all the clauses, but will also forget absolutely
everything about the procedure. retractall/1
only erases the
clauses. This is important if the procedure is called later on.
Since retractall/1
erases all the dynamic clauses whose
heads match Head, it has no choices to make, and is
determinate. If there are no such clauses, it succeeds trivially.
None of the variables in Head will be instantiated by this
command.
instantiation_error
type_error
permission_error
retract/1
, ref-mdb-rcd.