Fix print bug

This commit is contained in:
greg 2017-12-04 03:26:38 -08:00
parent 2f263de8ba
commit 166bc3b3cb

View File

@ -53,10 +53,10 @@ impl EvaluatorState {
SymbolAtom(sym) => unimplemented!(), SymbolAtom(sym) => unimplemented!(),
expr @ StringAtom(_) => expr, expr @ StringAtom(_) => expr,
expr @ NumberAtom(_) => expr, expr @ NumberAtom(_) => expr,
Cons(ref car, ref cdr) => { Cons(car, cdr) => {
match **car { match *car {
SymbolAtom(ref sym) => match &sym[..] { SymbolAtom(ref sym) => match &sym[..] {
"quote" => unimplemented!(), "quote" => *cdr,
"eq?" => unimplemented!(), "eq?" => unimplemented!(),
"cons" => unimplemented!(), "cons" => unimplemented!(),
"car" => unimplemented!(), "car" => unimplemented!(),
@ -111,7 +111,7 @@ impl Sexp {
&SymbolAtom(ref sym) => format!("{}", sym), &SymbolAtom(ref sym) => format!("{}", sym),
&StringAtom(ref s) => format!("\"{}\"", s), &StringAtom(ref s) => format!("\"{}\"", s),
&NumberAtom(ref n) => format!("{}", n), &NumberAtom(ref n) => format!("{}", n),
&Cons(ref car, ref cdr) => format!("({} . {}", car.print(), cdr.print()), &Cons(ref car, ref cdr) => format!("({} . {})", car.print(), cdr.print()),
&Nil => format!("()"), &Nil => format!("()"),
} }
} }