From: Mark Date: Wed, 22 Nov 2023 16:24:07 +0000 (-0700) Subject: remove assert(a,z)/2 (#1975) X-Git-Tag: v0.9.4~105^2 X-Git-Url: https://git.sagredo.dev/?a=commitdiff_plain;h=2811660fa7976f653b4d8dda551c72f7d5491a1a;p=scryer-prolog.git remove assert(a,z)/2 (#1975) --- diff --git a/src/lib/builtins.pl b/src/lib/builtins.pl index 34f607f6..2e18d94f 100644 --- a/src/lib/builtins.pl +++ b/src/lib/builtins.pl @@ -1173,8 +1173,13 @@ clause(H, B) :- % The clause will be inserted at the beginning of the module. asserta(Clause0) :- loader:strip_subst_module(Clause0, user, Module, Clause), - iso_ext:asserta(Module, Clause). + asserta_(Module, Clause). +asserta_(Module, (Head :- Body)) :- + !, + '$asserta'(Module, Head, Body). +asserta_(Module, Fact) :- + '$asserta'(Module, Fact, true). :- meta_predicate assertz(:). @@ -1184,7 +1189,13 @@ asserta(Clause0) :- % The clase will be inserted at the end of the module. assertz(Clause0) :- loader:strip_subst_module(Clause0, user, Module, Clause), - iso_ext:assertz(Module, Clause). + assertz_(Module, Clause). + +assertz_(Module, (Head :- Body)) :- + !, + '$assertz'(Module, Head, Body). +assertz_(Module, Fact) :- + '$assertz'(Module, Fact, true). :- meta_predicate retract(:). diff --git a/src/lib/iso_ext.pl b/src/lib/iso_ext.pl index 5096bfb9..15c05fd2 100644 --- a/src/lib/iso_ext.pl +++ b/src/lib/iso_ext.pl @@ -17,9 +17,7 @@ but they're not part of the ISO Prolog standard at the moment. succ/2, call_nth/2, countall/2, - copy_term_nat/2, - asserta/2, - assertz/2]). + copy_term_nat/2]). :- use_module(library(error), [can_be/2, domain_error/3, @@ -384,21 +382,3 @@ countall(Goal, N) :- copy_term_nat(Source, Dest) :- '$copy_term_without_attr_vars'(Source, Dest). -%% asserta(Module, Rule_Fact). -% -% Similar to `asserta/1` but allows specifying a Module -asserta(Module, (Head :- Body)) :- - !, - '$asserta'(Module, Head, Body). -asserta(Module, Fact) :- - '$asserta'(Module, Fact, true). - -%% assertz(Module, Rule_Fact). -% -% Similar to `assertz/1` but allows specifying a Module -assertz(Module, (Head :- Body)) :- - !, - '$assertz'(Module, Head, Body). -assertz(Module, Fact) :- - '$assertz'(Module, Fact, true). -