Availability:built-in
[ISO]asserta(+Term)
[ISO]assertz(+Term)
[deprecated]assert(+Term)Assert a clause (fact or rule) into the database. The predicate
asserta/1
asserts the clause as first clause of the predicate while
assertz/1
assert the clause as last clause. The deprecated assert/1
is equivalent to assertz/1.
If the program space for the target module is limited (see set_module/1), asserta/1
can raise a
resource_error(program_space)
exception. The example below
adds two facts and a rule. Note the double parentheses around the rule.
?- assertz(parent('Bob', 'Jane')).
?- assertz(female('Jane')).
?- assertz((mother(Child, Mother) :-
parent(Child, Mother),
female(Mother))).