summaryrefslogtreecommitdiffstats
path: root/eval.c
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2022-07-18 06:15:49 -0700
committerKaz Kylheku <kaz@kylheku.com>2022-07-18 06:15:49 -0700
commit1fcd2951cbca8b1a72b0a7665032859139f03d10 (patch)
tree12e4d72a84f2f32495bd0a0e1790ebe1d92e52cb /eval.c
parent980942732a366f2042eac777b2d1e259a19d3652 (diff)
downloadtxr-1fcd2951cbca8b1a72b0a7665032859139f03d10.tar.gz
txr-1fcd2951cbca8b1a72b0a7665032859139f03d10.tar.bz2
txr-1fcd2951cbca8b1a72b0a7665032859139f03d10.zip
New function: count.
The general count function, with keyfun and testfun, is noticeably absent. Let's implement it. * lib.[ch] (count): New function. * eval.c (eval_init): Register count intrinsic. * tests/012/seq.tl: Some tests for count. * txr.1: Add count to count-if section. Revise documentation based on pos/pos-if. * stdlib/doc-syms.tl: Updated.
Diffstat (limited to 'eval.c')
-rw-r--r--eval.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/eval.c b/eval.c
index 7f207de9..7fdc9627 100644
--- a/eval.c
+++ b/eval.c
@@ -7016,6 +7016,7 @@ void eval_init(void)
reg_fun(intern(lit("countql"), user_package), func_n2(countql));
reg_fun(intern(lit("countq"), user_package), func_n2(countq));
reg_fun(intern(lit("count-if"), user_package), func_n3o(count_if, 2));
+ reg_fun(intern(lit("count"), user_package), func_n4o(count, 2));
reg_fun(intern(lit("posqual"), user_package), func_n2(posqual));
reg_fun(intern(lit("rposqual"), user_package), func_n2(rposqual));
reg_fun(intern(lit("posql"), user_package), func_n2(posql));