From 671e454c7c2d4080e3737efd9132ac9a63d808db Mon Sep 17 00:00:00 2001 From: Oskari Timperi Date: Wed, 14 May 2014 23:44:27 +0300 Subject: eval: misc --- eval.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/eval.c b/eval.c index 23a6992..249ab1c 100644 --- a/eval.c +++ b/eval.c @@ -99,13 +99,14 @@ struct list *eval(struct list *list) } else if (strcmp(sym, "eq") == 0) { - struct list *a = l->next; - if (!a) - return list_append(NULL, &false_atom); + struct list *a = CDR(l); + struct list *b = CDR(a); - struct list *b = a->next; - if (!b) - return list_append(NULL, &false_atom); + if (!a || !b) + { + printf("error: eq takes 2 arguments\n"); + return list_append(NULL, &nil_atom); + } a = eval(a); b = eval(b); -- cgit v1.2.3