summaryrefslogtreecommitdiffstats
path: root/tests/010/tree.tl
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2021-05-09 17:45:55 -0700
committerKaz Kylheku <kaz@kylheku.com>2021-05-09 17:45:55 -0700
commit96715da165569922e1efa584eb0ce4f4d272c46d (patch)
tree08e2b19c2c2a9637d2f70785c5a6a3a47de365d3 /tests/010/tree.tl
parent8a7a4963a6cdf0a0d8b7145aefb4a40f5f26c673 (diff)
downloadtxr-96715da165569922e1efa584eb0ce4f4d272c46d.tar.gz
txr-96715da165569922e1efa584eb0ce4f4d272c46d.tar.bz2
txr-96715da165569922e1efa584eb0ce4f4d272c46d.zip
tree: new tree-peek function.
* tree.c (tn_peek_next): New static function. (tree_peek): New function. (tree_init): Register tree-peek intrinsic. * tree.h (tree_peek): Declared. * txr.1: Documented. * tests/010/tree.c: Work tree-peek into existing test case. * share/txr/stdlib/doc-syms.tl: Updated.
Diffstat (limited to 'tests/010/tree.tl')
-rw-r--r--tests/010/tree.tl8
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/010/tree.tl b/tests/010/tree.tl
index 6a1d4aa1..86a21167 100644
--- a/tests/010/tree.tl
+++ b/tests/010/tree.tl
@@ -48,6 +48,14 @@
(add (key n))))
(range 0 19))
+(vtest (build (for* ((j (tree-begin tr))
+ (i (progn (tree-next j) (tree-next j) (tree-reset j tr)))
+ (n (tree-peek i)))
+ ((and n (eq (tree-next i) n)))
+ ((set n (tree-peek i)))
+ (add (key n))))
+ (range 0 19))
+
(defvarl trc (copy-search-tree tr))
(vtest trc tr)