diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2019-09-03 23:30:22 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2019-09-03 23:30:22 -0700 |
commit | 8fdc890bfaae2df85d5437d9ae495c45a54645c4 (patch) | |
tree | 30c09d3692d075ec9de3d5923145d9308b3f2158 /struct.c | |
parent | 1777ba3dc87c62cf18cd178f2055369979907dc8 (diff) | |
download | txr-8fdc890bfaae2df85d5437d9ae495c45a54645c4.tar.gz txr-8fdc890bfaae2df85d5437d9ae495c45a54645c4.tar.bz2 txr-8fdc890bfaae2df85d5437d9ae495c45a54645c4.zip |
list-builder: bugfix: broken self-appending.
The list builder is failing on the documented example
(build
(add 1 2)
(pend (get))
(pend (get)))
-> (1 2 1 2 1 2 1 2)
wrongly constructing an infinite list.
* share/txr/stdlib/build.tl (list-builder pend): When
destructively appending the next argument, check whether
the current tail is a tail of that object. If so, copy
the object to prevent a cycle from forming.
(list-builder pend*): When appending the old head to the
catenated list, do the tail check and copy the object if
necessary to prevent the creation of a cycle.
Diffstat (limited to 'struct.c')
0 files changed, 0 insertions, 0 deletions