Next: , Previous: , Up: mpg-bpr   [Contents][Index]


11.3.194 retractall/1   ISO

Synopsis

retractall(+Head)

Removes every clause in module M whose head matches Head.

Arguments

:Head

callable, must be nonvar

Head of a Prolog clause.

Description

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, then it succeeds trivially. None of the variables in Head will be instantiated by this command.

If the predicate did not previously exist, then it is created as a dynamic predicate and retractall/1 succeeds.

Exceptions

instantiation_error

Head or Module is uninstantiated.

type_error

Head is not a callable.

permission_error

the procedure corresponding to Head is not dynamic.

See Also

retract/1, ref-mdb-rcd.


Send feedback on this subject.