diff options
| author | Oskari Timperi <oskari.timperi@iki.fi> | 2014-05-14 23:44:27 +0300 |
|---|---|---|
| committer | Oskari Timperi <oskari.timperi@iki.fi> | 2014-05-14 23:44:27 +0300 |
| commit | 671e454c7c2d4080e3737efd9132ac9a63d808db (patch) | |
| tree | f54b85a5c7550c874e80644f5681f11b10c5cc97 | |
| parent | 5625b0abb184d0302cff0979d6c1ae33d46db7ef (diff) | |
| download | lispish-671e454c7c2d4080e3737efd9132ac9a63d808db.tar.gz lispish-671e454c7c2d4080e3737efd9132ac9a63d808db.zip | |
eval: misc
| -rw-r--r-- | eval.c | 13 |
1 files changed, 7 insertions, 6 deletions
@@ -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); |
