Re: [go-nuts] Fast string sorting

2017-06-14 Thread Stefan Nilsson
I added a function radix.SortSlice similar to sort.Slice. Instead of a comparison function, it takes a function that serves the relevant strings: // SortSlice sorts a slice according to the strings returned by str. func SortSlice(slice interface{}, str func(i int) string) { The performance

Re: [go-nuts] Fast string sorting

2017-06-13 Thread Stefan Nilsson
That's an interesting challenge! What the algorithm really does is to first find a permutation that will sort the string slice, and then apply this permutation to the slice. Perhaps it would be possible to return this permutation in some cheap usable format. On Tuesday, June 13, 2017 at 7:56:54

Re: [go-nuts] Fast string sorting

2017-06-13 Thread 'Thomas Bushnell, BSG' via golang-nuts
That's really nice! Consider a case where I am sorting a slice of structs, but the underlying sort is based on a string within the structs. Or, with some other radixable datatype besides strings. Can we figure out an interface (similar to sort.Interface) which would permit a solution for either o