From: Mark Thom Date: Thu, 27 Sep 2018 01:33:27 +0000 (-0600) Subject: move term_variables to builtins X-Git-Tag: v0.8.110~361 X-Git-Url: https://git.sagredo.dev/?a=commitdiff_plain;h=6f668a8b7a6b379e8cf32afa045c2fdf20f95d87;p=scryer-prolog.git move term_variables to builtins --- diff --git a/README.md b/README.md index e1829689..1339b10e 100644 --- a/README.md +++ b/README.md @@ -153,7 +153,7 @@ The following predicates are built-in to rusty-wam. * `member/2` * `memberchk/2` * `nonvar/1` -* `numbervars/{2,3}` +* `numbervars/2` * `once/1` * `partial_string/2` * `rational/1` diff --git a/src/prolog/lib/builtins.pl b/src/prolog/lib/builtins.pl index 5e82723a..b07b7e96 100644 --- a/src/prolog/lib/builtins.pl +++ b/src/prolog/lib/builtins.pl @@ -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), diff --git a/src/prolog/lib/terms.pl b/src/prolog/lib/terms.pl index 7c16f021..8e87b975 100644 --- a/src/prolog/lib/terms.pl +++ b/src/prolog/lib/terms.pl @@ -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) :-