summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2021-06-09 23:35:38 -0700
committerKaz Kylheku <kaz@kylheku.com>2021-06-09 23:35:38 -0700
commit864d1c6fe182661a7bd7d4eda928f8a19318b651 (patch)
treea26ede9a8bf91e7b42aef355e19a37980233c065 /tests
parente57c4d0857fcf8b4e4369bde72c7453d2ae98125 (diff)
downloadtxr-864d1c6fe182661a7bd7d4eda928f8a19318b651.tar.gz
txr-864d1c6fe182661a7bd7d4eda928f8a19318b651.tar.bz2
txr-864d1c6fe182661a7bd7d4eda928f8a19318b651.zip
reduce-left: rewrite using seq_iter.
* lib.c (reduce_left): Use sequence iteration instead of list operations. * txr.1: Add a note to the documentation.
Diffstat (limited to 'tests')
-rw-r--r--tests/012/seq.tl10
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/012/seq.tl b/tests/012/seq.tl
index 49d4046b..95ba7b6e 100644
--- a/tests/012/seq.tl
+++ b/tests/012/seq.tl
@@ -72,3 +72,13 @@
(lambda (. args) (/ (sum args) 5))
#(4 7 9 13 5 1 6 11 10 3 8)]
#(4.0 6.6 7.6 7.0 6.8 7.2 6.6 6.2 7.6 6.4 4.2))
+
+(mtest
+ [reduce-left + () 0] 0
+ [reduce-left + ()] 0
+ [reduce-left cons ()] :error
+ [reduce-left cons '(1)] 1
+ [reduce-left cons #(1)] 1
+ [reduce-left cons #(1) : (op * 10)] 10
+ [reduce-left cons #(1) 2 (op * 10)] (2 . 10)
+ [reduce-left cons #(2 3) 10 (op * 10)] ((10 . 20) . 30))