summaryrefslogtreecommitdiffstats
path: root/lib.c
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2021-12-17 20:37:34 -0800
committerKaz Kylheku <kaz@kylheku.com>2021-12-17 20:37:34 -0800
commit3cbec98b7e80e75b4cd1e164c56c6e82ab0d7240 (patch)
tree3325cd36e631fe07b2c4e67b4ef1605a81a1f870 /lib.c
parentf0493b337617d403dc572975784f1a54c741a76e (diff)
downloadtxr-3cbec98b7e80e75b4cd1e164c56c6e82ab0d7240.tar.gz
txr-3cbec98b7e80e75b4cd1e164c56c6e82ab0d7240.tar.bz2
txr-3cbec98b7e80e75b4cd1e164c56c6e82ab0d7240.zip
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.
Diffstat (limited to 'lib.c')
-rw-r--r--lib.c2
1 files changed, 2 insertions, 0 deletions
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);