aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/util.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/util.py b/src/util.py
index d42515b..ef7cd52 100644
--- a/src/util.py
+++ b/src/util.py
@@ -95,10 +95,10 @@ def reduce(f, items):
@param f:(¿E?, ¿E?)→¿E? The function
@param item:itr<¿E?> The input
- @return ¿E? The output
+ @return ¿E?? The output, `None` if `item` is empty
'''
- if len(items) < 2:
- return [] if len(items) == 0 else items[0]
+ if len(items) == 0:
+ return None
rc = items[0]
for i in range(1, len(items)):
rc = f(rc, items[i])