diff --git a/src/pebblisp.c b/src/pebblisp.c index 4d7e990..6ce55f3 100644 --- a/src/pebblisp.c +++ b/src/pebblisp.c @@ -197,13 +197,15 @@ Object listEvalLambda( env ); Object ret = eval(&lambda->lambda->body, &newEnv); + deleteEnv(&newEnv); cleanObject(lambda); Object *t = tail(&ret); if(t) { - // cleanObject(&ret); - return cloneObject(*t); + Object o = cloneObject(*t); + cleanObject(&ret); + return o; } return ret; } @@ -259,8 +261,13 @@ Object evalList(const Object *obj, struct Environment *env) default: { // Return list with each element evaluated Object list = listObject(); + int i = 0; + nf_addToList(&list, first_eval); FOR_POINTER_IN_LIST(obj) { - nf_addToList(&list, eval(POINTER, env)); + if(i != 0) { + nf_addToList(&list, eval(POINTER, env)); + } + i++; } return list; } @@ -491,7 +498,7 @@ Object print(Object p, Object ignore, struct Environment *env) p = cloneObject(p); p = eval(&p, env); _printObj(&p, 0); - return p; + return numberObject(0); } Object pChar(Object c, Object i1, struct Environment *i2)