From d11500c643edd1303d8e9d60185eedabdb8c4eed Mon Sep 17 00:00:00 2001 From: greg Date: Sun, 10 Dec 2017 19:01:44 -0800 Subject: [PATCH] Even more concise --- src/rukka_lang/mod.rs | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/src/rukka_lang/mod.rs b/src/rukka_lang/mod.rs index 33aa441..ee977bb 100644 --- a/src/rukka_lang/mod.rs +++ b/src/rukka_lang/mod.rs @@ -82,17 +82,13 @@ 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)?, - _ => { - let evaled = self.eval(SymbolAtom(sym))?; - self.apply(evaled, operands)? - } - }, - _ => unimplemented!() + 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(operator)?; + self.apply(evaled, operands)? } }, Nil => Nil,