diff options
| author | Felix Perktold <Felix.Perktold@student.uibk.ac.at> | 2025-12-22 15:35:40 +0100 |
|---|---|---|
| committer | Felix Perktold <Felix.Perktold@student.uibk.ac.at> | 2025-12-22 15:35:40 +0100 |
| commit | b43819ef8d2f7aca08c714392e9578f13e619d82 (patch) | |
| tree | e0caaf52ea7ea5e58a1d719c55696d057409bd94 /lisp.c | |
| parent | 42169e527f74d1b7ad7cd75faf35db149076298e (diff) | |
fix evaluation of lists (recursively eval all elems of list)
Diffstat (limited to 'lisp.c')
| -rw-r--r-- | lisp.c | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -208,6 +208,8 @@ value *eval(env *e, value *v) { } if (v->type == VT_PAIR) { + //printf("pair found: "); + //println_value(v); return eval_pair(e, v); } @@ -283,8 +285,9 @@ value *eval_pair(env *e, value *v) { } return apply(head_eval, reverse(args_eval)); } - - return v; + + // else evaluate the list recursively + return cons(eval(e, car(v)), eval(e, cdr(v))); } value *apply(value *lval, value *args) { |
