rank-completions ( results -- newresults )
Fuzzy completion
Prev:complete ( full short -- score )


Vocabulary
tools.completion

Inputs and outputs
resultsan alist
newresultsan alist


Word description
Sorts results by the first element of each pair, and discards the low 33% of the results.

Definition
USING: assocs kernel math math.order sequences
sequences.private sorting ;

IN: tools.completion

: rank-completions ( results -- newresults )
sort-keys <reversed> [ 0 [ first max ] reduce 3 /f ] keep
[ first-unsafe < ] with filter values ;