Adding Clauses to the Database

The assertion predicates are used to add clauses to the database in various ways. The relative position of the asserted clause with respect to other clauses for the same predicate is determined by the choice among assert/1, asserta/1, and assertz/1. A database reference that uniquely identify the clause being asserted is established by providing an optional second argument to any of the assertion predicates.


assert(C)
clause C is asserted in an arbitrary position in its predicate
assert(C,R)
as assert/1; reference R is returned
asserta(C)
clause C is asserted before existing clauses
asserta(C,R)
as asserta/1; reference R is returned
assertz(C)
clause C is asserted after existing clauses
assertz(C,R)
as assertz/1; reference R is returned
multifile_assertz(C)
add clause C to the end of a (possibly compiled) multifile procedure