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) => {
|
||||
@@ -504,7 +504,7 @@ impl<'a, TermMarker: Allocator<'a>> CodeGenerator<'a, TermMarker>
|
||||
if !target.is_empty() {
|
||||
code.push(Line::Query(target));
|
||||
}
|
||||
|
||||
|
||||
code.push(is_call!(temp_v!(1), at.unwrap_or(interm!(1))));
|
||||
},
|
||||
&Term::Constant(_, ref c @ Constant::Number(_)) => {
|
||||
|
||||
@@ -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
|
||||
};
|
||||
},
|
||||
@@ -1777,7 +1777,7 @@ SetupCallCleanupCutPolicy.")
|
||||
self.fail = !self.structural_eq_test(),
|
||||
_ => self.compare_term(qt)
|
||||
};
|
||||
|
||||
|
||||
self.p = self.cp;
|
||||
},
|
||||
&ControlInstruction::Deallocate => {
|
||||
@@ -1813,7 +1813,7 @@ SetupCallCleanupCutPolicy.")
|
||||
&ControlInstruction::DuplicateTermExecute => {
|
||||
self.duplicate_term();
|
||||
self.p = self.cp;
|
||||
},
|
||||
},
|
||||
&ControlInstruction::DynamicIs => {
|
||||
let a = self[temp_v!(1)].clone();
|
||||
let result = try_or_fail!(self, self.arith_eval_by_metacall(temp_v!(2)));
|
||||
|
||||
@@ -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