Some ops support several args e.g. (+ 1 2 3)

This commit is contained in:
= 2020-05-06 06:00:40 +01:00
parent 6616cadbd5
commit f2c09c0818
2 changed files with 5 additions and 2 deletions

View File

@ -224,10 +224,14 @@ Object eval(const Object *obj, struct Environment *env)
Object rest[length]; Object rest[length];
eval_forms(rest, obj, env); 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); // deleteList(obj);
return func_eval; return func_eval;
} else if (first_eval.type == TYPE_LAMBDA) { } else if (first_eval.type == TYPE_LAMBDA) {
struct Environment newEnv = struct Environment newEnv =
envForLambda(&first_eval.lambda->params, first_form->forward, env); envForLambda(&first_eval.lambda->params, first_form->forward, env);

View File

@ -5,7 +5,6 @@
#include <stdio.h> #include <stdio.h>
#else #else
#include <pebble.h> #include <pebble.h>
// #define printf(...) nf_tokenize(NULL)
#endif #endif
/* /*