In Go is possible to compare two strings:
package main
func main() {
println("ab" > "ba")
println("ab" < "ba")
}
false
true
Program exited.
https://go.dev/play/p/svkLf6R84SC
How do I perform a similar operation on two slices? e.g. []int{1,2} > []int{2,1}
.
I need this to sort a slice of slices of ints. So I need an implementation of sort.Interface
.
type Interface interface {
Len() int
Less(i, j int) bool
Swap(i, j int)
}
It would be better if this implementation is generic.