[ Dynamic Predicates | The ECLiPSe Built-In Predicates | Reference Manual | Alphabetic Index ]

retract_all(+Head)

Succeeds if all the clauses whose heads match Head are successfully removed from the database.
Head
Atom, variable or compound term.

Description

Retracts from the database all clauses whose heads match the argument. The argument must be sufficiently instantiated otherwise an error is signalled. retract_all/1 never fails. The clauses are not reasserted when backtracking through the call of retract_all/1.

The functor and the arity of Head must be that of a predicate declared as dynamic.

retract_all/1 satisfies the logical update semantics. Using it to retract all the clauses of a predicate will not, in any way, affect previous calls to the predicate.

Modes and Determinism

Modules

This predicate is sensitive to its module context (tool predicate, see @/2).

Exceptions

(4) instantiation fault
Head is not instantiated
(5) type error
Head is not a callable term
(63) procedure not dynamic
Procedure is not dynamic
(70) accessing an undefined dynamic procedure
Procedure is undefined

Examples

Success:
    [eclipse]: assert(city(munich)), assert(city(london)).
    yes.
    [eclipse]: retract_all(city(_)).
    yes.
    [eclipse]: city(X).
    no (more) solution.
Error:
    retract_all(X).                  (Error 4).
    retract_all("x").                (Error 5).


   % if h/0 is defined, but not as dynamic..
    retract_all(h).                  (Error 63).

    retract_all(z/0).                (Error 70).



See Also

dynamic / 1, asserta / 1, retract / 1