     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>
 

    ] each partials ;

:: sum-exact ( partials -- n )
    partials empty? [ 0.0 ] [
        ! sum from the top, stop when sum becomes inexact
        0.0 0.0 partials [
            nip partial+ dup 0.0 = not
        ] find-last drop :> ( lo n )


    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 ;
