     seq natural-sort :> sorted
     seq length :> len
     sorted 0 [ + ] cum-reduce :> ( a b )
-    b len a * / :> B
-    1 len recip + 2 B * - ;
+    b len a * / :> c
+    1 len recip + 2 c * - ;
 
 PRIVATE>
 

                y yr = [ drop x ] when
            ] when
        ] when
    ] if ;

PRIVATE>


    unzip cum-sum [ last random ] [ bisect-left ] bi swap nth ;

: unique-indices ( seq -- unique indices )
    [ members ] keep over dup length <iota>
    H{ } zip-as '[ _ at ] map ;

: digitize] ( seq bins -- seq' )
    '[ _ bisect-left ] map ;
