math.extras: don't shadow B (breakpoint).

clean-macosx-x86-64
John Benediktsson 2019-11-07 21:43:22 -08:00
parent 8d8e59c43e
commit 234a5bd744
1 changed files with 7 additions and 6 deletions

View File

@ -173,8 +173,8 @@ PRIVATE>
seq natural-sort :> sorted seq natural-sort :> sorted
seq length :> len seq length :> len
sorted 0 [ + ] cum-reduce :> ( a b ) sorted 0 [ + ] cum-reduce :> ( a b )
b len a * / :> B b len a * / :> c
1 len recip + 2 B * - ; 1 len recip + 2 c * - ;
PRIVATE> PRIVATE>
@ -202,7 +202,8 @@ PRIVATE>
unzip cum-sum [ last random ] [ bisect-left ] bi swap nth ; unzip cum-sum [ last random ] [ bisect-left ] bi swap nth ;
: unique-indices ( seq -- unique indices ) : unique-indices ( seq -- unique indices )
[ members ] keep over dup length <iota> H{ } zip-as '[ _ at ] map ; [ members ] keep over dup length <iota>
H{ } zip-as '[ _ at ] map ;
: digitize] ( seq bins -- seq' ) : digitize] ( seq bins -- seq' )
'[ _ bisect-left ] map ; '[ _ bisect-left ] map ;
@ -313,9 +314,9 @@ PRIVATE>
] each partials ; ] each partials ;
:: sum-exact ( partials -- n ) :: sum-exact ( partials -- n )
partials empty? [ 0.0 ] [ partials [ 0.0 ] [
! sum from the top, stop when sum becomes inexact ! sum from the top, stop when sum becomes inexact
0.0 0.0 partials [ [ 0.0 0.0 ] dip [
nip partial+ dup 0.0 = not nip partial+ dup 0.0 = not
] find-last drop :> ( lo n ) ] find-last drop :> ( lo n )
@ -330,7 +331,7 @@ PRIVATE>
y yr = [ drop x ] when y yr = [ drop x ] when
] when ] when
] when ] when
] if ; ] if-empty ;
PRIVATE> PRIVATE>