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

retractall/1

MINERVA
ifcomputer logo
f
Expert Services on the Web

deletes from the database all clauses which head is unifiable with the argument.

retractall(+Head)

retractall/1 deletes all clauses from the database which head is unifiable with Head.
That means that retractall/1 can be defined as:

retractall(Head) :- retract((Head :- _)), fail.
retractall(_).

Arguments

Head              head of a clause

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.
retractall(colour(X)). Succeeds. The database contains now the clauses:
colour(blue,yellow,green).
add(X,Y,Z) :- Z is X+Y.
f(a).
f(b) :- b.

Standard

This predicate is not part of the ISO-Prolog Standard.

See also

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

document: http://www.ifcomputer.co.jp/MINERVA/Manual/Reference/Predicates/clause_creat_destruct/retractall/print_en.html
published 2008/9/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