diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2024-02-27 06:47:47 -0800 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2024-02-27 06:47:47 -0800 |
commit | abfc025c6e6c6db4acaeef74801dc4baaa2376bd (patch) | |
tree | e63c4a3835951db7654e651c4a8c59ad034d3cca | |
parent | 06dfa00f02b6c816849dcee4e0dbc1133a3f6eb2 (diff) | |
download | txr-abfc025c6e6c6db4acaeef74801dc4baaa2376bd.tar.gz txr-abfc025c6e6c6db4acaeef74801dc4baaa2376bd.tar.bz2 txr-abfc025c6e6c6db4acaeef74801dc4baaa2376bd.zip |
seq_build: allow initialization from iterator.
* lib.c (seq_build_init): Replicate a feature of make_like:
if the reference object is an iterator, then we recurse: we
initialize according to the object it is iterating.
-rw-r--r-- | lib.c | 6 |
1 files changed, 6 insertions, 0 deletions
@@ -1545,6 +1545,12 @@ void seq_build_init(seq_build_t *bu, val likeobj) bu->ops = &sb_buf_ops; break; case COBJ: + if (likeobj->co.cls == seq_iter_cls) + { + struct seq_iter *si = coerce(struct seq_iter *, likeobj->co.handle); + seq_build_init(bu, si->inf.obj); + break; + } if (obj_struct_p(likeobj)) { val from_list_meth = get_special_slot(likeobj, from_list_m); |