]> gitweb.factorcode.org Git - factor.git/commitdiff
extras: fix using/deleted word
authorDoug Coleman <doug.coleman@gmail.com>
Sat, 25 Feb 2023 23:14:36 +0000 (17:14 -0600)
committerDoug Coleman <doug.coleman@gmail.com>
Sun, 26 Feb 2023 23:11:05 +0000 (17:11 -0600)
extra/assocs/extras/extras-tests.factor
extra/sequences/extras/extras-tests.factor
extra/sequences/extras/extras.factor

index 2ca1b4cd67bf8132a1fb9b08e8fd0a2efd84b744..15c86a1857909ba5946cba359d94803f5cd8495b 100644 (file)
@@ -1,4 +1,5 @@
-USING: arrays assocs.extras kernel math math.order sequences tools.test ;
+USING: arrays assocs assocs.extras kernel math math.order
+sequences tools.test ;
 
 {
     H{ { 1 V{ 10 } } { 2 V{ 10 } } { 3 V{ 10 } } { 4 V{ 10 } } { 5 V{ 10 } } }
@@ -21,14 +22,6 @@ USING: arrays assocs.extras kernel math math.order sequences tools.test ;
     H{ { 1 H{ { 2 H{ { 3 4 } } } } } } dup { 1 2 3 } 40 deep-set-of
 ] unit-test
 
-{ { { 1 1 } { 2 2 } { 0 3 } { 0 4 } { 0 5 } } } [
-    { 1 2 } { 1 2 3 4 5 } 0 zip-longest-with
-] unit-test
-
-{ { { 1 1 } { 2 2 } { f 3 } { f 4 } { f 5 } } } [
-    { 1 2 } { 1 2 3 4 5 } zip-longest
-] unit-test
-
 { H{ { 2 1 } { 4 3 } } } [ H{ { 1 2 } { 3 4 } } assoc-invert ] unit-test
 
 { H{ { "a" V{ 2 5 } } { "b" V{ 3 } } { "c" V{ 10 } } } }
index c18401ef65c3217940ccd51575e2ae0629dc6607..c116a51aeac3cb15cee0703ad4796a2d3c98c600 100644 (file)
@@ -487,3 +487,11 @@ strings tools.test ;
 
 { 20 1 } [ 0 { 10 20 30 } [ drop 20 = ] find-index-from* ] unit-test
 { f f } [ 0 { 10 20 30 } [ drop 21 = ] find-index-from* ] unit-test
+
+{ { { 1 1 } { 2 2 } { 0 3 } { 0 4 } { 0 5 } } } [
+    { 1 2 } { 1 2 3 4 5 } 0 zip-longest-with
+] unit-test
+
+{ { { 1 1 } { 2 2 } { f 3 } { f 4 } { f 5 } } } [
+    { 1 2 } { 1 2 3 4 5 } zip-longest
+] unit-test
index a36caa74de56b87d4d373fe40cdfb96c3972788e..6408dd5796aa58e51ef5fe86b243bb85531cd5f6 100644 (file)
@@ -309,6 +309,9 @@ PRIVATE>
 
 : inc-at* ( key assoc -- old new ) [ 1 ] 2dip at+* ; inline
 
+: occurrence-count-by ( seq quot: ( elt -- elt' ) -- hash seq' )
+    '[ nip @ over inc-at* drop ] [ H{ } clone ] 2dip 0accumulate ; inline
+
 : progressive-index-by-as ( seq1 seq2 quot exemplar -- hash seq' )
     [
         pick length '[