elvish
elvish copied to clipboard
Add sorter API for completion candidates
Add an API for sorting completion candidates.
This can be a function that gets all candidates as inputs, and outputs an equal number of numbers, strings or lists. The outputs must be of the same type and are used for sorting the corresponding inputs.
The sorter is run separately for each different candidate type (#914).
This is also related to #651.
I'm sure I'm misunderstanding something, because I don't think it's practical to have a function that receives all candidates and returns numeric values for all of them. This would mean that the function needs to establish a total "order value" over the whole list, essentially sorting the list in the process! The scalability of a sorting algorithm comes from the fact that you only need to be able to determine the order among two elements at a time.
It could also produce strings and lists.