Logtalk reference manual
Built-in method: retractall/1
Contents > Reference Manual > Built-in Methods > retractall/1

## retractall/1

#### Description

    retractall(Head)

Retracts all clauses with a matching head for a dynamic predicate. When the predicate indicator for `Head` is declared in a `uses/2` or `use_module/2` directive, the clauses are retracted in the referenced object or module. Otherwise the clauses are retracted in an object's dynamic predicate.

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

    retractall(+callable)

#### 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, Name/Arity, is that of a private predicate:
  `permission_error(modify, private_predicate, Name/Arity)`
The predicate indicator of Head, Name/Arity, is that of a protected predicate:
  `permission_error(modify, protected_predicate, Name/Arity)`
The predicate indicator of Head, Name/Arity, is that of a static predicate:
  `permission_error(modify, static_predicate, Name/Arity)`
The predicate indicator of Head, Name/Arity, is not declared:
  `existence_error(predicate_declaration, Name/Arity)`

#### Examples

To retract all local predicate clauses or all predicate clauses in this with a matching head:
  `retractall(Head)`
To retract all public or protected predicate clauses with a matching head in self:
  `::retractall(Head)`
To retract all public predicate clauses with a matching head in an explicit object:
  `Object::retractall(Head)`

#### See also

`abolish/1`, `asserta/1`, `assertz/1`, `clause/2`, `retract/1`
`dynamic/0`, `dynamic/1`
`uses/2`, `use_module/2`