]> gitweb.factorcode.org Git - factor.git/commitdiff
sequences: add tests for map-reduce
authorDoug Coleman <doug.coleman@gmail.com>
Fri, 19 Aug 2022 03:49:00 +0000 (22:49 -0500)
committerDoug Coleman <doug.coleman@gmail.com>
Sun, 26 Feb 2023 23:11:03 +0000 (17:11 -0600)
core/sequences/sequences-tests.factor

index 3b33a7cb6f1b684642295d17027e5da7495e9a9d..c28e5c7bc0d6a6914dfcb0308d4a5c66978fe54d 100644 (file)
@@ -29,6 +29,18 @@ IN: sequences.tests
     [ 1 [ [ * ] [ + ] bi* ] reduce-index ] bi@
 ] unit-test
 
+{ 21 } [
+    { 1 2 3 } { 4 5 6 } 0 [ + + ] 0 2reduce-from
+] unit-test
+
+{ 16 } [
+    { 1 2 3 } { 4 5 6 } 0 [ + + ] 1 2reduce-from
+] unit-test
+
+{ -541365 } [
+    { 10 21 32 } { 500 600 700 } [ - sq ] [ - ] 2map-reduce
+] unit-test
+
 { 5040 { 1 1 2 6 24 120 720 } }
 [ { 1 2 3 4 5 6 7 } 1 [ * ] accumulate ] unit-test