]> Repositorios git - scryer-prolog.git/commitdiff
move forall/2 to non_iso, correct test cases.
authorMark Thom <[email protected]>
Thu, 4 Apr 2019 00:12:36 +0000 (18:12 -0600)
committerMark Thom <[email protected]>
Thu, 4 Apr 2019 00:12:36 +0000 (18:12 -0600)
src/prolog/lib/builtins.pl
src/prolog/machine/mod.rs
src/tests.rs

index 8756c5d0640fa40af05b9055c99a7fd120ed3004..247113153fd531a597f06de0a90c8fdb7eb3844d 100644 (file)
@@ -10,7 +10,7 @@
        bb_get/2, bb_put/2, call_cleanup/2,
        call_with_inference_limit/3, catch/3, clause/2,
        current_predicate/1, current_prolog_flag/2, expand_goal/2,
-       expand_term/2, findall/3, findall/4, forall/2, halt/0, once/1, op/3,
+       expand_term/2, findall/3, findall/4, halt/0, once/1, op/3,
        repeat/0, retract/1, set_prolog_flag/2, setof/3,
        setup_call_cleanup/3, term_variables/2, throw/1, true/0,
        false/0, write/1, write_canonical/1, writeq/1, write_term/2]).
@@ -405,9 +405,6 @@ findall(Template, Goal, Solutions0, Solutions1) :-
                                      Error,
                                      ( truncate_lh_to(LhLength), throw(Error) ))).
 
-forall(Generate, Test) :-
-    \+ (Generate, \+ Test).
-
 set_difference([X|Xs], [Y|Ys], Zs) :-
     X == Y, !, set_difference(Xs, [Y|Ys], Zs).
 set_difference([X|Xs], [Y|Ys], [X|Zs]) :-
index 4bc5c852a994cc6ea0dd715478bfa29ac1af9339..f3d690cf79896cd470f0c1e51fb8b7bcd49e1b76 100644 (file)
@@ -143,6 +143,7 @@ impl SubModuleUser for IndexStore {
 }
 
 static BUILTINS: &str = include_str!("../lib/builtins.pl");
+static NON_ISO: &str  = include_str!("../lib/non_iso.pl");
 static LISTS: &str    = include_str!("../lib/lists.pl");
 static QUEUES: &str   = include_str!("../lib/queues.pl");
 static ERROR: &str    = include_str!("../lib/error.pl");
@@ -176,6 +177,7 @@ impl Machine {
     }
 
     fn compile_libraries(&mut self) {
+        compile_user_module(self, NON_ISO.as_bytes());
         compile_user_module(self, LISTS.as_bytes());
         compile_user_module(self, QUEUES.as_bytes());
         compile_user_module(self, ERROR.as_bytes());
index c925ce8495c38a216ff0c07c50863ba23e3d7fdd..56287c347226528135c325a1e16cbed3ef1630b5 100644 (file)
@@ -1801,9 +1801,11 @@ fn test_queries_on_builtins()
     assert_prolog_success!(&mut wam, "?- setof(X, Y^((X = 1 ; Y = 1) ; (X = 2, Y = 2)), S).",
                            [["S = [_240, 1, 2]", "X = _0", "Y = _5"]]);
     assert_prolog_success!(&mut wam, "?- setof(X, (exists(U,V) ^ member(X, [V,U,f(U),f(V)])), [a,b,f(b),f(a)]).");
-        
-    assert_prolog_failure!(&mut wam, "?- forall(true, fail).");
-    assert_prolog_success!(&mut wam, "?- forall(fail, true)");
+
+    submit(&mut wam, ":- use_module(library(non_iso)).");
+    
+    assert_prolog_failure!(&mut wam, "?- forall(true, false).");
+    assert_prolog_success!(&mut wam, "?- forall(false, true).");
     assert_prolog_success!(&mut wam, "?- catch(forall(_, true), error(instantiation_error, _), true).");
     assert_prolog_success!(&mut wam, "?- catch(forall(true, _), error(instantiation_error, _), true).");
     assert_prolog_success!(&mut wam, "?- catch(forall(1, true), error(type_error(callable, 1), _), true).");