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. --- lib.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'lib.c') diff --git a/lib.c b/lib.c index dca7474d..1bcd9ffc 100644 --- a/lib.c +++ b/lib.c @@ -12253,6 +12253,8 @@ val length(val seq) return hash_count(seq); if (seq->co.cls == carray_cls) return length_carray(seq); + if (seq->co.cls == tree_cls) + return tree_count(seq); if (obj_struct_p(seq)) { val length_meth = get_special_slot(seq, length_m); -- cgit v1.2.3