From 96715da165569922e1efa584eb0ce4f4d272c46d Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Sun, 9 May 2021 17:45:55 -0700 Subject: 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. --- tests/010/tree.tl | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'tests/010') 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) -- cgit v1.2.3