diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2018-03-21 07:00:43 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2018-03-21 07:00:43 -0700 |
commit | 70817a322732eef130dd943ac95d6d9c4b805920 (patch) | |
tree | ae9e3df3e4a342608b58e274d4b603bafe1630c6 | |
parent | e64bfa71cdb0f3be303ebb872e05540497197a58 (diff) | |
download | txr-70817a322732eef130dd943ac95d6d9c4b805920.tar.gz txr-70817a322732eef130dd943ac95d6d9c4b805920.tar.bz2 txr-70817a322732eef130dd943ac95d6d9c4b805920.zip |
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.
-rw-r--r-- | share/txr/stdlib/compiler.tl | 2 |
1 files changed, 1 insertions, 1 deletions
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))))))) |