From 3cbec98b7e80e75b4cd1e164c56c6e82ab0d7240 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Fri, 17 Dec 2021 20:37:34 -0800 Subject: tree-count: new function. * tree.c (tree_count): New function. (tree_init): tree-count intrinsic registered. * tree.h (tree_count): Declared. * lib.c (length): Support search tree argument via tree_count. * tests/010/tree.tl: Test cases for tree-count, indirectly via len. * txr.1: Documented. --- tests/010/tree.tl | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'tests') diff --git a/tests/010/tree.tl b/tests/010/tree.tl index 06d02ce6..f5bfac42 100644 --- a/tests/010/tree.tl +++ b/tests/010/tree.tl @@ -5,8 +5,16 @@ (test tr #T(())) -(test (treep tr) t) -(test (treep 42) nil) +(mtest + (treep tr) t + (treep 42) nil) + +(mtest + (len #T()) 0 + (len #T(() 1)) 1 + (len #T(() 1 2)) 2 + (len #T(() 1 2 3)) 3 + (len #T(() 1 1 1)) 3) (each ((n keys)) (tree-insert tr n)) -- cgit v1.2.3