math: use sorted-histogram values in a few places.

master
John Benediktsson 2020-01-28 16:21:33 -08:00
parent 94cbe2b479
commit 548109bf4b
2 changed files with 3 additions and 3 deletions

View File

@ -675,7 +675,7 @@ PRIVATE>
{ 0 1 2 } { 0 1 2 }
{ 3 4 5 } { 3 4 5 }
{ 6 7 8 } { 6 7 8 }
} matrix-except-all dup flatten sorted-histogram [ second ] map } matrix-except-all dup flatten sorted-histogram values
{ [ length 9 = ] [ [ 4 = ] all? ] } { [ length 9 = ] [ [ 4 = ] all? ] }
1&& 1&&
] unit-test ] unit-test
@ -690,7 +690,7 @@ PRIVATE>
{ 4 5 6 7 } { 4 5 6 7 }
{ 8 9 10 11 } { 8 9 10 11 }
{ 12 13 14 15 } { 12 13 14 15 }
} matrix-except-all flatten sorted-histogram [ second ] map } matrix-except-all flatten sorted-histogram values
{ [ length 16 = ] [ [ 9 = ] all? ] } { [ length 16 = ] [ [ 9 = ] all? ] }
1&& 1&&
] unit-test ] unit-test

View File

@ -19,7 +19,7 @@ CONSTANT: knucleotide-in "vocab:benchmark/knucleotide/knucleotide-input.txt"
: handle-table ( inputs n -- ) : handle-table ( inputs n -- )
clump clump
[ histogram sort-values reverse ] [ length ] bi [ sorted-histogram reverse ] [ length ] bi
'[ '[
[ first write bl ] [ first write bl ]
[ second 100 * _ /f "%.3f" printf nl ] bi [ second 100 * _ /f "%.3f" printf nl ] bi