Merge pull request #1127 from triska/retract_correction

Correct retract/1 issues due to module qualification
This commit is contained in:
Mark Thom
2021-12-04 16:23:00 -07:00
committed by GitHub

View File

@@ -954,7 +954,7 @@ retract_module_clause(Head, Body, Module) :-
). ).
first_match_index([Clause | Clauses], Clause, N, N) :- first_match_index([Clause | _], Clause, N, N) :-
!. !.
first_match_index([_ | Clauses], Clause, N0, N) :- first_match_index([_ | Clauses], Clause, N0, N) :-
N1 is N0 + 1, N1 is N0 + 1,
@@ -998,14 +998,14 @@ retract_clause(Head, Body) :-
:- meta_predicate retract(0). :- meta_predicate retract(0).
retract(Clause) :- retract(Clause0) :-
( Clause \= (_ :- _) -> strip_module(Clause0, Module, Clause),
Head = Clause, ( Clause = (Head :- Body) ->
Body = true, true
retract_clause(Head, Body) ; Head = Clause,
; Clause = (Head :- Body) -> Body = true
retract_clause(Head, Body) ),
). retract_clause(Module:Head, Body).
:- meta_predicate retractall(0). :- meta_predicate retractall(0).