projog

3.56. erase(X) - removes a record from the recorded database.

Removes from the recorded database the term associated with the reference specified by X. The goal succeeds even if there is no term associated with the specified reference.

Examples

Add three records to the recorded database.

?- recordz(k,a,_), recordz(k,b,_), recordz(k,c,_).

yes

Confirm the records have been added.

?- recorded(k,X).
X = a

yes;
X = b

yes;
X = c

yes

Erase (i.e. remove) a record.

?- recorded(k,b,X), erase(X).
X = 1

yes;

no

Confirm the record has been removed.

?- recorded(k,X).
X = a

yes;
X = c

yes