diff --git a/src/eval.rs b/src/eval.rs index 0686b62..42a3637 100644 --- a/src/eval.rs +++ b/src/eval.rs @@ -46,14 +46,22 @@ pub fn eval( // another check to detect if we may have a function call if let Ctr::Symbol(ref tok) = car { - if let Ctr::Seg(ast) = cdr { - if let Some(func) = funcs.borrow().get(tok) { - return func_call(func.clone(), ast.clone(), vars.clone(), funcs.clone()) - } else { - return Err(format!("Couldnt find function: {}.", tok)) - } - } else { - return Err(format!("Arguments to function not a list!")) + match cdr { + Ctr::Seg(ast) => { + if let Some(func) = funcs.borrow().get(tok) { + return func_call(func.clone(), ast.clone(), vars.clone(), funcs.clone()) + } else { + return Err(format!("Couldnt find function: {}.", tok)) + } + }, + Ctr::None => { + if let Some(func) = funcs.borrow().get(tok) { + return func_call(func.clone(), new_ast(Ctr::None, Ctr::None), vars.clone(), funcs.clone()) + } else { + return Err(format!("Couldnt find function: {}.", tok)) + } + }, + _ => return Err(format!("Arguments to function not a list!")) } }