Even more concise
This commit is contained in:
parent
8493233b69
commit
d11500c643
@ -82,19 +82,15 @@ impl EvaluatorState {
|
||||
expr @ NumberAtom(_) => expr,
|
||||
True => True,
|
||||
False => False,
|
||||
Cons(box operator, box operands) => {
|
||||
match operator {
|
||||
SymbolAtom(sym) => match &sym[..] {
|
||||
"quote" | "eq?" | "cons" | "car" | "cdr" | "atom?" |
|
||||
"define" | "lambda" | "if" | "cond" => self.eval_special_form(&sym[..], operands)?,
|
||||
Cons(box operator, box operands) => match operator {
|
||||
SymbolAtom(ref sym) if match &sym[..] {
|
||||
"quote" | "eq?" | "cons" | "car" | "cdr" | "atom?" | "define" | "lambda" | "if" | "cond" => true, _ => false
|
||||
} => self.eval_special_form(sym, operands)?,
|
||||
_ => {
|
||||
let evaled = self.eval(SymbolAtom(sym))?;
|
||||
let evaled = self.eval(operator)?;
|
||||
self.apply(evaled, operands)?
|
||||
}
|
||||
},
|
||||
_ => unimplemented!()
|
||||
}
|
||||
},
|
||||
Nil => Nil,
|
||||
})
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user