The Prolog database can be updated during the execution of a program. ECLiPSe allows the user to modify procedures dynamically by adding new clauses via assert/1 and by removing some clauses via retract/1. These predicates operate on dynamic procedures; if it is required that the definition of a procedure be altered through assertion and retraction, the procedure should therefore first be declared dynamic (see the previous section). The effect of assert/1 and retract/1 on static procedures is explained below.
The effect of the goal
where ProcClause is a clause of the procedure Proc, is as follows.assert(ProcClause)
The goal
will unify Clause with a clause on the dynamic database and remove it. If Clause does not specify a dynamic procedure, an exception is raised.retract(Clause)
ECLiPSe 's dynamic database features the so-called logical update semantics. This means that any change in the database that occurs as a result of executing one of the builtins of the abolish, assert or retract family affects only those goals that start executing afterwards. For every call to a dynamic procedure, the procedure is virtually frozen at call time.