aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--eval.c13
1 files 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);