[ Dynamic Predicates | The ECLiPSe Built-In Predicates | Reference Manual | Alphabetic Index ]

# clause(+Clause)

Succeeds if Clause unifies with a clause of a dynamic procedure.

Clause
  Atom or compound term

## Description

Finds a dynamic clause whose head unifies with the head of Clause and unifies the body of the clause with the body of Clause. The head of Clause must be sufficiently instantiated so that the predicate (head) of the clause can be determined. The functor of the head of Clause must be that of a procedure previously declared as dynamic using dynamic/1.

This goal may be resatisfied if there are several clauses which match the first argument. In the first solution the argument will be unified with the first such clause. Subsequent solutions will unify the argument to the other clauses in the same order in which they are listed by listing/0, 1.

clause/1 satisfies the logical update semantics. When clause/1 is first called, it makes a virtual copy of the clauses that match and, on backtracking, unifies its argument with them. Any modifications made to the procedure after clause/1 has started executing do not, in any way, affect the solutions produced. A subsequent call, however makes and uses a new, virtual, copy of the modified database.

### Modes and Determinism

- clause(+) is nondet

### Modules

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

### Fail Conditions

Fails if no dynamic clause unifies with Clause

### Exceptions

(4) instantiation fault
  Clause is not instantiated
(4) instantiation fault
  The head of Clause is a free variable.
(63) procedure not dynamic
  Procedure is not dynamic
(70) accessing an undefined dynamic procedure
  Procedure is undefined

## See Also

clause / 2