IF Computer > MINERVA > Manual > Reference > Predicates > Clause creation and destruction > retract/1

retract/1

MINERVA
ifcomputer logo
f
Expert Services on the Web

retracts from the database the clauses which are unifiable with the argument.

retract(+Clause)

retract/1 retracts the first clause from the database which is unifiable with Clause . If Clause is an atom or compound term whose principal functor is different from ':-'/2 then Clause is the head and 'true' is the body of the clause.
If Clause is a compound term whose principal functor is ':-'/2 then the left side (1st argument) of ':-' is the head and the right side (2nd argument) the body of the clause.

By backtracking it's possible to remove all clauses from the database, which are unifiable with Clause.

Arguments

Clause              atom or compound term

Examples

Assume that the database contains the clauses:
      colour(blue).
      colour(yellow).
      colour(blue,yellow,green).
      add(X,Y,Z) :- Z is X+Y.
      f(a).
      f(a) :- b.
retract(f(a)). Succeeds. The database contains now the clauses:
colour(blue).
colour(yellow) :- true.
colour(blue,yellow) :- green.
add(X,Y,Z) :- Z is X+Y.
f(a) :- b.

Standard

This predicate is part of the ISO-Prolog Standard.

See also

asserta/1, assertz/1, abolish/1, collect/3, load/1, unload/1, load/1/2, retractall/1.

document: http://www.ifcomputer.co.jp/MINERVA/Manual/Reference/Predicates/clause_creat_destruct/retract/print_de.html
published 2008/12/1 update 2003/2/26 (c) 1996-2006 IF Computer Japan
IF Computer 5-28-2 Sendagi, Bunkyo-ku Tel +81-3-5814-3352 start (AT) ifcomputer.com
Customer Support Tokyo 113-0022 Japan   http://www.ifcomputer.com
Back> managed with ubiCMS