another tweak to eval/quote equivalency, more tests

This commit is contained in:
Ava Apples Affine 2023-06-08 17:11:10 -07:00
parent 33791c7f3b
commit 0a01f9178c
3 changed files with 42 additions and 57 deletions

View file

@ -48,7 +48,16 @@ fn eval_callback(ast: &Seg, syms: &mut SymTable) -> Result<Ctr, Traceback> {
Err(e) => Err(e.with_trace(
("eval", "evaluation failure")
.into())),
Ok(s) => Ok(*s),
Ok(s) => if let Ctr::Seg(ref inner) = *s {
match eval(inner, syms) {
Err(e) => Err(e.with_trace(
("eval", "evaluation failure")
.into())),
Ok(s) => Ok(*s),
}
} else {
Ok(*s)
},
}
}
@ -73,25 +82,6 @@ fn eval_callback(ast: &Seg, syms: &mut SymTable) -> Result<Ctr, Traceback> {
},
_ => Ok(*ast.car.clone())
}
/* this bit removed because it was determined eval shouldnt do things twice
* kept here for reference purposes since I have gone back and forth on this
* a bit
*
* thank you for your patience (ava)
match arguments {
Ctr::Seg(ref s) => Ok(*eval(s, syms)?.clone()),
Ctr::Symbol(ref sym) => {
let intermediate = syms.call_symbol(sym, &Seg::new(), true)?;
if let Ctr::Seg(ref s) = *intermediate {
Ok(*eval(s, syms)?.clone())
} else {
Ok(*intermediate)
}
},
_ => Ok(arguments)
}*/
}
}