divide atom tables by module

This commit is contained in:
Mark Thom
2018-10-03 22:56:12 -06:00
parent 61536d2004
commit 8e4bb039f0
13 changed files with 113 additions and 79 deletions

View File

@@ -6,9 +6,8 @@
(=:=)/2, (-)/1, (>=)/2, (=<)/2, (,)/2, (->)/2, (;)/2, (=..)/2,
(==)/2, (\==)/2, (@=<)/2, (@>=)/2, (@<)/2, (@>)/2, (=@=)/2,
(\=@=)/2, (:)/2, call_with_inference_limit/3, catch/3,
current_prolog_flag/2, set_prolog_flag/2,
setup_call_cleanup/3, term_variables/2, throw/1, true/0,
false/0]).
current_prolog_flag/2, set_prolog_flag/2, term_variables/2,
setup_call_cleanup/3, throw/1, true/0, false/0]).
/* this is an implementation specific declarative operator used to implement call_with_inference_limit/3
and setup_call_cleanup/3. switches to the default trust_me and retry_me_else. Indexing choice
@@ -206,8 +205,12 @@ get_args([Arg|Args], Func, I0, N) :-
'$call_with_default_policy'(I1 is I0 + 1),
'$call_with_default_policy'(get_args(Args, Func, I1, N)).
term_variables(Term, Vars) :- '$term_variables'(Term, Vars).
% term_variables.
term_variables(Term, Vars) :-
error:can_be(list, Vars),
'$term_variables'(Term, Vars).
% setup_call_cleanup.
setup_call_cleanup(S, G, C) :- '$get_b_value'(B),

View File

@@ -1,12 +1,16 @@
:- module(terms, [numbervars/3]).
:- use_module(library(error)).
numbervars(Term, N0, N) :-
catch(internal_numbervars(Term, N0, N), error(E,Ctx),
( ( var(Ctx) -> Ctx = numbervars/3 ; true ), throw(error(E,Ctx) ) ) ).
internal_numbervars(Term, N0, N) :-
must_be(integer, N0),
can_be(integer, N),
term_variables(Term, Vars),
numberlist(Vars, N0,N).
numberlist(Vars, N0, N).
numberlist([], N,N).
numberlist(['$VAR'(N0)|Vars], N0,N) :-