assertz(+Clause)

Add specified clause at the end of the dynamic procedure to the database

Clause

Atom or compound term

Description

Adds the specified clause for a dynamic procedure to the database.]
The clause is added AFTER any existing clauses for the procedure.
This is an alias for assert/1.

The procedure must be declared to be dynamic using the dynamic/1
built-in. If the procedure is undefined an exception is raised.
However, the default error handler for this exception simply declares
the procedure dynamic and asserts the clause.

The asserted clause is NOT removed from the database on backtracking
through the call to assertz/1.

assertz/1 satisfies the logical update semantics. Asserting a clause to
a procedure will not, in any way, affect previous calls to it when
backtracking.

No clause transformation is performed on Clause. Use expand_clause/2 to
explicitly expand the clause before calling this predicate if clause
expansion is rquired.

Modes and Determinism

assertz(+) is det

Modules

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

Exceptions

(4) instantiation fault

Clause is a free variable.

(4) instantiation fault

The head of Clause is a free variable.

(5) type error

Clause is not a valid Prolog clause.

(63) procedure not dynamic

The procedure is not dynamic.

(70) accessing an undefined dynamic procedure

The procedure is undefined. However, the default error handler for this exception simply declares the procedure dynamic and asserts the clause, if the error was caused by an assert.