Fix bug with merge2 and ,@, add (let)
diff --git a/src/lisp/lisp.c b/src/lisp/lisp.c
index 6299e03..8002319 100644
--- a/src/lisp/lisp.c
+++ b/src/lisp/lisp.c
@@ -603,12 +603,12 @@
void del_alloc(struct alloc *alloc)
{
- if (alloc->type_tag == CLOSURE_TAG)
- {
- fprintf(stderr, "del_alloc closure\n");
- struct closure_alloc *ca = alloc;
- free(ca->closure.args);
- }
+ /* if (alloc->type_tag == CLOSURE_TAG) */
+ /* { */
+ /* fprintf(stderr, "del_alloc closure\n"); */
+ /* struct closure_alloc *ca = alloc; */
+ /* free(ca->closure.args); */
+ /* } */
free_aligned(alloc);
}
@@ -723,17 +723,20 @@
}
}
-value_t *nilptr(value_t val)
+value_t *nilptr(value_t *val)
{
- if (!listp(val))
+ if (!val)
return NULL;
- if (nilp(val))
+ if (!listp(*val))
return NULL;
+ if (nilp(*val))
+ return val;
+
value_t *p;
- for (p = cdrref(val); !nilp(*p); p = cdrref(*p))
+ for (p = cdrref(*val); !nilp(*p); p = cdrref(*p))
{
}
@@ -748,7 +751,7 @@
if (listp(front) && !listp(back))
back = cons(back, nil);
- *nilptr(front) = back;
+ *nilptr(&front) = back;
return front;
}