set compound to succeed on non-empty lists.
This commit is contained in:
@@ -368,7 +368,7 @@ impl<'a, TermMarker: Allocator<'a>> CodeGenerator<'a, TermMarker>
|
||||
},
|
||||
&InlinedQueryTerm::IsCompound(ref inner_term) =>
|
||||
match inner_term[0].as_ref() {
|
||||
&Term::Clause(..) => {
|
||||
&Term::Clause(..) | &Term::Cons(..) => {
|
||||
code.push(succeed!());
|
||||
},
|
||||
&Term::Var(ref vr, ref name) => {
|
||||
|
||||
@@ -1371,7 +1371,7 @@ SetupCallCleanupCutPolicy.")
|
||||
let d = self.store(self.deref(self[r].clone()));
|
||||
|
||||
match d {
|
||||
Addr::Str(_) => self.p += 1,
|
||||
Addr::Str(_) | Addr::Lis(_) => self.p += 1,
|
||||
_ => self.fail = true
|
||||
};
|
||||
},
|
||||
|
||||
@@ -1311,12 +1311,12 @@ fn test_queries_on_builtins()
|
||||
|
||||
assert_prolog_success!(&mut wam, "?- compound(functor(compound)).");
|
||||
assert_prolog_success!(&mut wam, "?- compound(f(X)).");
|
||||
assert_prolog_success!(&mut wam, "?- compound([1,2,3]).");
|
||||
assert_prolog_failure!(&mut wam, "?- compound([]).");
|
||||
assert_prolog_failure!(&mut wam, "?- compound(3.14159269).");
|
||||
assert_prolog_failure!(&mut wam, "?- compound(3).");
|
||||
assert_prolog_failure!(&mut wam, "?- compound(\"sdfsa\").");
|
||||
assert_prolog_failure!(&mut wam, "?- compound(atom).");
|
||||
assert_prolog_failure!(&mut wam, "?- compound([1,2,3]).");
|
||||
assert_prolog_failure!(&mut wam, "?- compound([1,2,X]).");
|
||||
|
||||
assert_prolog_failure!(&mut wam, "?- string(functor(string)).");
|
||||
assert_prolog_failure!(&mut wam, "?- string(3.14159269).");
|
||||
|
||||
Reference in New Issue
Block a user