summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--lib.c4
2 files changed, 9 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index a5036e15..2e3a0e50 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
2014-07-29 Kaz Kylheku <kaz@kylheku.com>
+ * lib.c (reduce_left, reduce_right): Nullify incoming sequence
+ argument so empty vectors and strings can be processed.
+
+2014-07-29 Kaz Kylheku <kaz@kylheku.com>
+
* eval.c (giterate_func, giterate): Adjusting semantics of giterate to
include seed item in the sequence. The while test is applied to
each item before it is passed through the function. Also,
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))