From 5e7aef1040ac4ad3fd0604028d8f5a93b7d03c1e 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,