diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2021-05-09 23:01:53 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2021-05-09 23:01:53 -0700 |
commit | 07d3266440d15c67f450c6f0a26e85a1541f4395 (patch) | |
tree | 79939ce8df58e581528e41fb0eace3f827b62047 /tests/006/freeform-3.expected | |
parent | 5cb27535f5f0cdbcc0eca8976cac47bd178ae230 (diff) | |
download | txr-07d3266440d15c67f450c6f0a26e85a1541f4395.tar.gz txr-07d3266440d15c67f450c6f0a26e85a1541f4395.tar.bz2 txr-07d3266440d15c67f450c6f0a26e85a1541f4395.zip |
lib: basic support for trees as sequences.
As of this commit, binary search trees can be iterated:
mapped over with mapcar and such.
* arith.c (poly, rpoly): rpoly won't work with trees. They
work just with vectors and lists so let's make the error
message more accurate. I noticed the self names of these two
are swapped; will fix in another commit.
* eval.c (tprint): Refactor to use iterator framework for
objects other than lists. The tree case falls into this,
so trees are supported.
* lib.h (enum seq_kind): New enum constant SEQ_TREELIKE.
(seq_iter_init_with_info): Declared.
* lib.c (seq_info): Map tree object to SEQ_TREELIKE type.
(seq_iter_get_tree, seq_iter_peek_tree): New static functions.
(seq_iter_rewind): Support rewinding tree iteration.
I think we could reuse the existing iterator here, and in the
hash case as well. I made a note to look into this.
(seq_iter_init_with_info): Internal linkage changed to
external, because tprint in eval.c uses this.
Handle SEQ_TREELIKE case here, by setting up iterator with the
two new static functions.
(seq_iter_mark): Handle SEQ_TREELIKE_CASE. Change switch
statement to exhaustively list cases.
(ldiff): Add SEQ_TREELIKE to various cases. Idea is that we
handle it like SEQ_HASH.
(nsort, sort, nshuffle, take, take_while, take_until,
drop_while, drop_until, update): Add case for SEQ_TREELIKE,
routing to error message.
(lazy_where_tree_func): New static function.
(where, sel, reject): Support trees.
Diffstat (limited to 'tests/006/freeform-3.expected')
0 files changed, 0 insertions, 0 deletions