From ee93befb6473258ef880b5d4175487a4d901fb5e Mon Sep 17 00:00:00 2001 From: Kaz Kylheku <kaz@kylheku.com> Date: Sat, 2 Feb 2019 18:52:48 -0800 Subject: 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. --- lib.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib.h') diff --git a/lib.h b/lib.h index 64a08e3d..aab0083d 100644 --- a/lib.h +++ b/lib.h @@ -712,8 +712,8 @@ val gev(val first, struct args *rest); val lev(val first, struct args *rest); val numeqv(val first, struct args *rest); val numneqv(struct args *list); -val sum(val seq); -val prod(val seq); +val sum(val seq, val keyfun); +val prod(val seq, val keyfun); val max2(val a, val b); val min2(val a, val b); val maxv(val first, struct args *rest); -- cgit v1.2.3