aboutsummaryrefslogtreecommitdiff
path: root/eval.c
diff options
context:
space:
mode:
authorOskari Timperi <oskari.timperi@iki.fi>2014-05-14 23:44:27 +0300
committerOskari Timperi <oskari.timperi@iki.fi>2014-05-14 23:44:27 +0300
commit671e454c7c2d4080e3737efd9132ac9a63d808db (patch)
treef54b85a5c7550c874e80644f5681f11b10c5cc97 /eval.c
parent5625b0abb184d0302cff0979d6c1ae33d46db7ef (diff)
downloadlispish-671e454c7c2d4080e3737efd9132ac9a63d808db.tar.gz
lispish-671e454c7c2d4080e3737efd9132ac9a63d808db.zip
eval: misc
Diffstat (limited to 'eval.c')
-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);