diff --git a/src/pebblisp.c b/src/pebblisp.c index 498069b..bd25c56 100644 --- a/src/pebblisp.c +++ b/src/pebblisp.c @@ -340,14 +340,14 @@ Object filter(Object obj1, Object obj2, struct Environment *env) Object append(Object list, Object newElement, struct Environment *env) { Object newList = cloneObject(list); - nf_addToList(&newList, newElement); + nf_addToList(&newList, cloneObject(newElement)); return newList; } Object prepend(Object list, Object newElement, struct Environment *env) { Object newList = listObject(); - nf_addToList(&newList, newElement); + nf_addToList(&newList, cloneObject(newElement)); appendList(&newList, &list); return newList; } @@ -364,7 +364,7 @@ Object rest(Object list, Object ignore, struct Environment *env) FOR_POINTER_IN_LIST(l) { if(POINTER == l->list) continue; - nf_addToList(&ret, *POINTER); + nf_addToList(&ret, cloneObject(*POINTER)); } return ret; }