Download ciao Reference Manual - pdf
Transcript
Chapter 33: Dynamic predicates 189 33 Dynamic predicates Author(s): The CLIP Group. Version: 1.10#6 (2004/8/7, 21:46:39 CEST) Version of last change: 1.9#197 (2003/12/19, 17:4:32 CET) This module implements the assert/retract family of predicates to manipulate dynamic predicates. The predicates defined in this module allow modification of the program as it is actually running. Clauses can be added to the program (asserted ) or removed from the program (retracted ). For these predicates, the argument which corresponds to the clause head must be instantiated to an atom or a compound term. The argument corresponding to the clause must be instantiated either to a term Head :- Body or, if the body part is empty, to Head. An empty body part is represented as true. Note that using this library is very detrimental to global analysis, and that for most uses the predicates listed in Chapter 25 [Fast/concurrent update of facts], page 147 suffice. 33.1 Usage and interface (dynamic) © ® • Library usage: :- use_module(library(dynamic)). • Exports: − Predicates: asserta/1, asserta/2, assertz/1, assertz/2, assert/1, assert/2, retract/1, retractall/1, abolish/1, clause/2, clause/3, current_predicate/1, current_ predicate/2, dynamic/1, data/1, wellformed_body/3. − Multifiles: do_on_abolish/1. • Other modules used: − System library modules: prolog_sys. ª 33.2 Documentation on exports (dynamic) asserta/1: PREDICATE Meta-predicate with arguments: asserta(clause). h • ISO • i Usage: asserta(+Clause) − Description: The current instance of Clause is interpreted as a clause and is added to the current program. The predicate concerned must be dynamic. The new clause becomes the first clause for the predicate concerned. Any uninstantiated variables in Clause will be replaced by new private variables. − The following properties hold globally: This predicate is understood natively by CiaoPP. (basic_props:native/1)
Related documents
Ciao Manual - The Ciao System
Ciao Manual - The Ciao System
from isi.edu - Information Sciences Institute
LPdoc Manual
Interfacing Prolog and VRML and its Application to Constraint
NDT TechTracker Demo Version Version 2.0 User Manual
User Manual for River Form & Channel Analysis
file
Interfacing Prolog and VRML and its Application to Constraint
GAMESS-UK USER'S GUIDE and REFERENCE MANUAL Version
How to setup and secure Snort, MySQL and Acid on