From f2c09c0818f920984758dd68b37202849906b860 Mon Sep 17 00:00:00 2001 From: = <=> Date: Wed, 6 May 2020 06:00:40 +0100 Subject: [PATCH] Some ops support several args e.g. (+ 1 2 3) --- src/pebblisp.c | 6 +++++- src/tokens.c | 1 - 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/pebblisp.c b/src/pebblisp.c index 4172763..736a83f 100644 --- a/src/pebblisp.c +++ b/src/pebblisp.c @@ -224,10 +224,14 @@ Object eval(const Object *obj, struct Environment *env) Object rest[length]; eval_forms(rest, obj, env); - Object func_eval = first_eval.func(rest[0], rest[1]); + Object func_eval = rest[0]; + for(int i = 1; i < length; i++) { + func_eval = first_eval.func(func_eval, rest[i]); + } // deleteList(obj); return func_eval; + } else if (first_eval.type == TYPE_LAMBDA) { struct Environment newEnv = envForLambda(&first_eval.lambda->params, first_form->forward, env); diff --git a/src/tokens.c b/src/tokens.c index f4bfd80..5bbfac1 100644 --- a/src/tokens.c +++ b/src/tokens.c @@ -5,7 +5,6 @@ #include #else #include -// #define printf(...) nf_tokenize(NULL) #endif /*