]> gitweb.factorcode.org Git - factor.git/blobdiff - core/assocs/assocs-tests.factor
assocs: refactor collect-by to use collect-by!
[factor.git] / core / assocs / assocs-tests.factor
index 4b0347904484ff7f6d57f3723dc262be2e707b89..931da8f2e013b5f2d90bea79deb2fe0f9849c0b8 100644 (file)
@@ -331,6 +331,17 @@ unit-test
     10 <iota> [ 3 mod ] collect-by
 ] unit-test
 
+{
+    H{
+        { 0 V{ 0 3 6 9 0 3 6 9 } }
+        { 1 V{ 1 4 7 1 4 7 } }
+        { 2 V{ 2 5 8 2 5 8 } }
+    }
+} [
+    10 <iota> [ 3 mod ] collect-by
+    10 <iota> [ 3 mod ] collect-by!
+] unit-test
+
 { H{ { 1 4 } } } [ H{ { 1 2 } } 1 over [ sq ] ?change-at ] unit-test
 { H{ { 1 2 } } } [ H{ { 1 2 } } 2 over [ sq ] ?change-at ] unit-test
 { H{ { 1 3 } } } [ H{ { 1 2 } } 3 1 pick [ drop dup ] ?change-at drop ] unit-test