]> Repositorios git - scryer-prolog.git/commitdiff
add subsumes_term/2
authorMark Thom <[email protected]>
Sun, 28 Apr 2019 20:48:12 +0000 (14:48 -0600)
committerMark Thom <[email protected]>
Sun, 28 Apr 2019 20:48:12 +0000 (14:48 -0600)
Cargo.toml
README.md
src/prolog/lib/builtins.pl

index 46257588ac3675b299959472beec3277062b8d32..fbd78ddbc99bb08220f787af96d5e3759ab67677 100644 (file)
@@ -1,6 +1,6 @@
 [package]
 name = "scryer-prolog"
-version = "0.8.71"
+version = "0.8.72"
 authors = ["Mark Thom <[email protected]>"]
 repository = "https://github.com/mthom/scryer-prolog"
 description = "A modern Prolog implementation written mostly in Rust."
index aa047a7688c47ced9763173eb27a964ee4d35dd4..da580e50ae8ecc1ad430bee3162eb39f0a63a482 100644 (file)
--- a/README.md
+++ b/README.md
@@ -223,6 +223,7 @@ The following predicates are built-in to Scryer.
 * `setup_call_cleanup/3`
 * `sort/2`
 * `string/1`
+* `subsumes_term/2`
 * `term_expansion/2`
 * `term_variables/2`
 * `throw/1`
index 7a4a09f90b55d08b73c4a3cc383151bb32d4e2c3..3a8d81e79eb3ce17790708451749f37d965e89e9 100644 (file)
@@ -17,8 +17,8 @@
        expand_goal/2, expand_term/2, false/0, findall/3, findall/4,
        get_char/1, halt/0, number_chars/2, once/1, op/3, read_term/2,
        repeat/0, retract/1, set_prolog_flag/2, setof/3,
-       term_variables/2, throw/1, true/0, write/1, write_canonical/1,
-       write_term/2, writeq/1]).
+       subsumes_term/2, term_variables/2, throw/1, true/0, write/1,
+       write_canonical/1, write_term/2, writeq/1]).
 
 % module resolution operator.
 :- op(600, xfy, :).
@@ -815,3 +815,11 @@ number_chars(N, Chs) :-
       '$number_to_chars'(N, Chsx),
       Chsx = Chs
     ).
+
+subsumes_term(General, Specific) :-
+   \+ \+ (
+      term_variables(Specific, SVs1),
+      General = Specific,
+      term_variables(SVs1, SVs2),
+      SVs1 == SVs2
+   ).