Logtalk reference manual
Built-in method: retract/1
retract/1
Description
retract(Head)
retract((Head:-Body))
Retracts a dynamic clause from an object.
This method may be used to retract clauses for predicates that are not declared dynamic for dynamic objects provided that the predicates are declared in this.
Template and modes
retract(+clause)
Errors
- Head is a variable:
instantiation_error
- Head is neither a variable nor a callable term:
type_error(callable, Head)
- The predicate indicator of Head, Functor/Arity, is that of a private predicate:
permission_error(modify, private_predicate, Functor/Arity)
- The predicate indicator of Head, Functor/Arity, is that of a protected predicate:
permission_error(modify, protected_predicate, Functor/Arity)
- The predicate indicator of Head, Functor/Arity, is that of a static predicate:
permission_error(modify, static_predicate, Functor/Arity)
- The predicate indicator of Head, Functor/Arity, is not declared:
existence_error(predicate_declaration, Functor/Arity)
Examples
- To retract a matching clause of a local dynamic predicate or a dynamic predicate in this:
retract(Clause)
- To retract a matching clause of a public or protected dynamic predicate in self:
::retract(Clause)
- To retract a matching clause of a public dynamic predicate in an explicit object:
Object::retract(Clause)
See also
abolish/1
, asserta/1
, assertz/1
, clause/2
, retractall/1
dynamic/0
, dynamic/1