summaryrefslogtreecommitdiffstats
path: root/eval.c
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2019-02-02 18:52:48 -0800
committerKaz Kylheku <kaz@kylheku.com>2019-02-02 18:52:48 -0800
commitee93befb6473258ef880b5d4175487a4d901fb5e (patch)
tree322dc867de94b8f9aca85d6462234bdf600d34d0 /eval.c
parentc9cab7138636c6c1d6e47f8d1a4053bec2dd0ad4 (diff)
downloadtxr-ee93befb6473258ef880b5d4175487a4d901fb5e.tar.gz
txr-ee93befb6473258ef880b5d4175487a4d901fb5e.tar.bz2
txr-ee93befb6473258ef880b5d4175487a4d901fb5e.zip
sum and prod take keyfun argument.
* eval.c (eval_init): Adjust registrations of sum and prod to be binary functions with an optional argument. * lib.c (nary_op_keyfun, sumv, prodv): New static functions. (sum, prod): Implement optional keyfun argument via sumv and prodv helpers. * lib.h (sum, prod): Declarations updated. * txr.1: Documentation updated.
Diffstat (limited to 'eval.c')
-rw-r--r--eval.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/eval.c b/eval.c
index 2f803a70..c6022329 100644
--- a/eval.c
+++ b/eval.c
@@ -6400,8 +6400,8 @@ void eval_init(void)
reg_fun(plus_s = intern(lit("+"), user_package), func_n0v(plusv));
reg_fun(intern(lit("-"), user_package), func_n1v(minusv));
reg_fun(intern(lit("*"), user_package), func_n0v(mulv));
- reg_fun(intern(lit("sum"), user_package), func_n1(sum));
- reg_fun(intern(lit("prod"), user_package), func_n1(prod));
+ reg_fun(intern(lit("sum"), user_package), func_n2o(sum, 1));
+ reg_fun(intern(lit("prod"), user_package), func_n2o(prod, 1));
reg_fun(intern(lit("abs"), user_package), func_n1(abso));
reg_fun(intern(lit("trunc"), user_package), func_n2o(trunc, 1));
reg_fun(intern(lit("mod"), user_package), func_n2(mod));