From 70817a322732eef130dd943ac95d6d9c4b805920 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Wed, 21 Mar 2018 07:00:43 -0700 Subject: compiler: append-each: bugfix for non-lists. * share/txr/stdlib/compiler.tl: If a non-list sequence like a string or vector is being accumulated, we must have an append call, because the accumulation cell is never extended with new cells. After we replace the cdr of ,accum with a string or vector atom, (last ,accum) just finds ,accum and so then the cdr will be clobbered on the next iteration. --- share/txr/stdlib/compiler.tl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/share/txr/stdlib/compiler.tl b/share/txr/stdlib/compiler.tl index 47abf573..06935a02 100644 --- a/share/txr/stdlib/compiler.tl +++ b/share/txr/stdlib/compiler.tl @@ -679,7 +679,7 @@ ,*(caseq each-type (collect-each ^((rplacd ,accum (cons (progn ,*body) nil)) (sys:setq ,accum (cdr ,accum)))) - (append-each ^((rplacd ,accum (progn ,*body)) + (append-each ^((rplacd ,accum (append (cdr ,accum) (progn ,*body))) (sys:setq ,accum (last ,accum)))) (t body))))))) -- cgit v1.2.3