correct-ish definition of reverse.

This commit is contained in:
Mark Thom
2018-04-18 15:34:09 -06:00
3 changed files with 8 additions and 8 deletions

View File

@@ -537,7 +537,7 @@ impl fmt::Display for Constant {
&Constant::Atom(ref atom) => &Constant::Atom(ref atom) =>
write!(f, "{}", atom), write!(f, "{}", atom),
&Constant::Char(c) => &Constant::Char(c) =>
write!(f, "#\\{}", c), write!(f, "{}", c as u8),
&Constant::EmptyList => &Constant::EmptyList =>
write!(f, "[]"), write!(f, "[]"),
&Constant::Number(ref n) => &Constant::Number(ref n) =>

View File

@@ -679,6 +679,7 @@ pub fn compile_listing(wam: &mut Machine, src_str: &str) -> EvalSession
.or_insert(CodeIndex::default()); .or_insert(CodeIndex::default());
index.0.set(IndexPtr::Index(p)); index.0.set(IndexPtr::Index(p));
index.1 = module_name;
} }
decl_info.label_clauses(p, &mut code_dir, &mut decl_code); decl_info.label_clauses(p, &mut code_dir, &mut decl_code);

View File

@@ -426,17 +426,16 @@ pub(crate) trait CallPolicy: Any {
Ok(()) Ok(())
}, },
&ClauseType::CallN => { &ClauseType::CallN =>
if let Some((name, arity)) = machine_st.setup_call_n(arity) { if let Some((name, arity)) = machine_st.setup_call_n(arity) {
if let Some(idx) = code_dirs.get(name.clone(), arity, &machine_st.p.clone()) { if let Some(idx) = code_dirs.get(name.clone(), arity, &machine_st.p.clone()) {
return self.context_call(machine_st, name, arity, idx, lco); self.context_call(machine_st, name, arity, idx, lco)
} else { } else {
machine_st.fail = true; Err(predicate_existence_error(name, arity, machine_st.heap.h))
} }
} } else {
Ok(())
Ok(()) },
},
&ClauseType::Compare => { &ClauseType::Compare => {
let a1 = machine_st[temp_v!(1)].clone(); let a1 = machine_st[temp_v!(1)].clone();
let a2 = machine_st[temp_v!(2)].clone(); let a2 = machine_st[temp_v!(2)].clone();