move term_variables to builtins

This commit is contained in:
Mark Thom
2018-09-26 19:33:27 -06:00
parent 4cf1aa0d8f
commit 6f668a8b7a
3 changed files with 12 additions and 17 deletions

View File

@@ -1,13 +1,14 @@
:- op(400, yfx, /).
:- module(builtins, [(=)/2, (+)/2, (**)/2, (*)/2, (-)/2, (/)/2, (/\)/2,
(\/)/2, (is)/2, (xor)/2, (div)/2, (//)/2, (rdiv)/2, (<<)/2,
(>>)/2, (mod)/2, (rem)/2, (>)/2, (<)/2, (=\=)/2, (=:=)/2,
(-)/1, (>=)/2, (=<)/2, (,)/2, (->)/2, (;)/2, (=..)/2, (==)/2,
(\==)/2, (@=<)/2, (@>=)/2, (@<)/2, (@>)/2, (=@=)/2, (\=@=)/2,
(:)/2, call_with_inference_limit/3, catch/3,
:- module(builtins, [(=)/2, (+)/2, (**)/2, (*)/2, (-)/2, (/)/2,
(/\)/2, (\/)/2, (is)/2, (xor)/2, (div)/2, (//)/2, (rdiv)/2,
(<<)/2, (>>)/2, (mod)/2, (rem)/2, (>)/2, (<)/2, (=\=)/2,
(=:=)/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, throw/1, true/0, false/0]).
setup_call_cleanup/3, term_variables/2, 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
@@ -205,6 +206,8 @@ 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).
% setup_call_cleanup.
setup_call_cleanup(S, G, C) :- '$get_b_value'(B),

View File

@@ -1,17 +1,9 @@
:- module(terms, [term_variables/2, numbervars/2, numbervars/3]).
term_variables(Term, Vars) :- '$term_variables'(Term, Vars).
:- module(terms, [numbervars/2]).
numbervars(Term, N) :-
integer(N),
term_variables(Term, Vars),
numberlist(Vars, N, N1).
numbervars(Term, N0, N) :-
integer(N0),
integer(N),
term_variables(Term, Vars),
numberlist(Vars, N0, N).
numberlist([], N,N).
numberlist(['$VAR'(N0)|Vars], N0,N) :-