What has recenty been implemented in SWI-Prolog and
Jekejeke Prolog is quite non-standard. Here is what
some other Prolog systems stil do:
3) GNU Prolog 1.4.4 (64 bits)
Compiled Apr 23 2013, 16:05:07 with cl
?- retract(insect(I)), write(I), nl,
retract(insect(bee)), fail; true.
ant
bee
yes
4) ECLiPSe Constraint Logic Programming System [kernel]
Version 6.1 #222 (x86_64_nt), Thu Jul 7 16:02 2016
[eclipse 3]: retract(insect(I)), write(I), nl,
retract(insect(bee)), fail; true.
ant
bee
I = I
Yes (0.00s cpu)
5) Ciao 1.15-1781-g328b907: Wed Jun 19 00:06:05 PST 2013
?- retract(insect(I)), write(I), nl,
retract(insect(bee)), fail; true.
ant
bee
yes
6) B-Prolog Version 8.1, All rights reserved,
(C) Afany Software 1994-2014.
?- retract(insect(I)), write(I), nl,
retract(insect(bee)), fail; true.
ant
bee
yes
A possible workaround, to regain ISO compatiblity would be
to change for example the bootstrapping code from:
retract(V) :- var(V),
throw(error(instantiation_error,_)).
retract((H :- B)) :- !,
clause(H, B, R), erase(R).
retract(H) :-
clause(H, true, R), erase(R).
Into the following code:
retract(V) :- var(V),
throw(error(instantiation_error,_)).
retract((H :- B)) :- !,
clause(H, B, R), ignore(erase(R)).
retract(H) :-
clause(H, true, R), ignore(erase(R)).
Whereby ignore/1 is defined as in here:
http://www.swi-prolog.org/pldoc/man?predicate=ignore/1
j4n bur53 schrieb: