Logtalk built-in method: retract/1

contents > reference manual > built-in methods

## `retract/1`

#### Description

>     retract(Clause)
>     retract((Head:-Body))

> Retracts a dynamic clause from an object.

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

#### Examples

> To retract a matching clause of any 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 object:
>   `Object::retract(Clause)`

previous | glossary | next
Copyright © Paulo Moura — Logtalk.org