retract(Fact)
Remove facts from the internal database.
Remarks
retract/1 deletes the first Fact in the database that matches the given Fact. During backtracking, the rest of the matching facts are deleted. The Fact is matched with the facts in the database, which means that any free variables will be bound in the call to retract.
Fail
When there are no more matches.
Example
fact1(1,"fact1",[1,2,3]). fact1(2,"fact2",[1,3]). fact1(3,"fact2",[3,2,1]). fact2(1,"one"). fact2(1,"one once more"). fact2(2,"two"). -------- Dialog -------- fact1(X,Y,Z) X=1, Y=fact1, Z=[1,2,3] X=2, Y=fact2, Z=[1,3] X=3, Y=fact2, Z=[3,2,1] 3 Solutions retract(fact1(X,Y,[_,2|Z])) X=1, Y=fact1, Z=[3] X=3, Y=fact2, Z=[1] 2 Solutions retract(fact1(X,Y,Z)) X=2, Y=fact2, Z=[1,3] 1 Solution fact1(X,Y,Z) No Solution retract(fact2(1,X)) X=one X=one once more 2 Solutions