diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2024-02-28 08:46:18 -0800 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2024-02-28 08:46:18 -0800 |
commit | d12b6d6896a9838abd925feae34f6c01d535f223 (patch) | |
tree | 6b14f862693f28a31e2b6ae0fa0d6f60939ad73f /lib.h | |
parent | 0490e3a4bf568584e7701ee34fd8f27b1f518404 (diff) | |
download | txr-d12b6d6896a9838abd925feae34f6c01d535f223.tar.gz txr-d12b6d6896a9838abd925feae34f6c01d535f223.tar.bz2 txr-d12b6d6896a9838abd925feae34f6c01d535f223.zip |
seq_build: convert list buiding to list_collect.
We want to use the list_collect functions for consistency.
For instance, these functions allow an atom to be added
to an improper list if the terminating atom is a sequence.
(append '(1 . "abc") "d") yields (1 . "abcd").
* lib.h (struct seq_build): New member, tail.
* lib.c (seq_build_list_add): Use list_collect.
(seq_build_list_pend): Use list_collect_nconc.
(seq_build_list_finish): Nothing to do here, except
call seq_build_convert_to_finished since bu->obj
is the head of the list at all times now.
(seq_build_improper_add, seq_build_improper_pend):
Functions removed.
(sb_improper_ops): Structure removed.
(seq_build_convert_to_improper): Function removed.
(seq_build_convert_to_list): Different strategy needed
here now. The list just goes into bu->obj, and we have
to set up the tail to either point to the last cons
cell's cdr, or else to bu->obj if the list is empty.
(seq_build_init): Initialize bu->tail in the three cases
that set up list collection.
Diffstat (limited to 'lib.h')
-rw-r--r-- | lib.h | 1 |
1 files changed, 1 insertions, 0 deletions
@@ -471,6 +471,7 @@ struct seq_iter_ops { typedef struct seq_build { val obj; + loc tail; val self; union { val from_list_meth; |