summaryrefslogtreecommitdiffstats
path: root/lib.c
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2014-07-29 07:20:44 -0700
committerKaz Kylheku <kaz@kylheku.com>2014-07-29 07:20:44 -0700
commite25ae2d57a7b7a5252d9a13441d963b7dd2b8c1a (patch)
tree9f800998758d145bee8c9eb857ce076077ea7557 /lib.c
parent73e7fd1df88999b02e89cd497e9baeb9a1a6bb40 (diff)
downloadtxr-e25ae2d57a7b7a5252d9a13441d963b7dd2b8c1a.tar.gz
txr-e25ae2d57a7b7a5252d9a13441d963b7dd2b8c1a.tar.bz2
txr-e25ae2d57a7b7a5252d9a13441d963b7dd2b8c1a.zip
* lib.c (reduce_left, reduce_right): Nullify incoming sequence
argument so empty vectors and strings can be processed.
Diffstat (limited to 'lib.c')
-rw-r--r--lib.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib.c b/lib.c
index 863be13b..2b209b77 100644
--- a/lib.c
+++ b/lib.c
@@ -3983,6 +3983,8 @@ val reduce_left(val fun, val list, val init, val key)
if (null_or_missing_p(key))
key = identity_f;
+ list = nullify(list);
+
if (missingp(init)) {
if (list)
init = pop(&list);
@@ -4001,6 +4003,8 @@ val reduce_right(val fun, val list, val init, val key)
if (null_or_missing_p(key))
key = identity_f;
+ list = nullify(list);
+
if (list) {
if (missingp(init)) {
if (!rest(list))