tisp

tiny lisp
git clone git://edryd.org/tisp
Log | Files | Refs | LICENSE

commit cb3f99dbfec0419643248f288823214f7f52ac33
parent dedd483d8cecea0a7910b9f4c39dd4dce26c0481
Author: Ed van Bruggen <edvb@uw.edu>
Date:   Sun, 27 Jan 2019 22:58:51 -0800

If element of list can't be evaluated, insert void

Diffstat:
tisp.c | 10+++++-----
1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/tisp.c b/tisp.c @@ -538,16 +538,16 @@ Val tisp_eval_list(Env env, Val v) { int cap = 1, size = 0; - Val *new = emalloc(sizeof(Val)); + Val ret, *new = emalloc(sizeof(Val)); for (; !nilp(v); v = cdr(v)) { - if (!(new[size++] = tisp_eval(env, car(v)))) - return NULL; - if (size == cap) { + if (!(new[size] = tisp_eval(env, car(v)))) + new[size] = env->none; + if (++size == cap) { cap *= 2; new = erealloc(new, cap*sizeof(Val)); } } - Val ret = mk_list(env, size, new); + ret = mk_list(env, size, new); free(new); return ret; }