Hi,
sorted := sortSliceIsSorted(indexes, func(i, j int) bool {
return rantings[indexes[i]] < rantings[indexes[j]]
})
fmt.Println("Slice sorted?:", sorted)
El jueves, 9 de noviembre de 2017, 9:36:47 (UTC-3), gaurav escribió:
>
> I realized the mistake :-p
> It needs to be this:
>
> sort.Sli
I realized the mistake :-p
It needs to be this:
sort.Slice(indexes, func(i, j int) bool {
return ratings[indexes[i]] < ratings[indexes[j]]
})
On Thursday, November 9, 2017 at 6:02:29 PM UTC+5:30, gaurav wrote:
>
> Hi Jan,
>
> I am still unable to understand why is the contract broken? The
>
Hi Jan,
I am still unable to understand why is the contract broken? The "magnitude"
of each entry in "indexes" slice is defined by less func in a consistent
way. What exactly am I doing incorrect here? If I changed the program to
create structs
type entry struct {
rating int
index int
}
And then
On Thu, Nov 9, 2017 at 1:17 PM gaurav wrote:
> I must be missing something basic here: a simple usage of sort.Slice is
not sorting the slice correctly for me. I must be missing something very
basic here; could someone please check this out?
The less test is perfomed on the ratings slice, but the
Hi All,
I must be missing something basic here: a simple usage of sort.Slice is not
sorting the slice correctly for me. I must be missing something very basic
here; could someone please check this out?
https://play.golang.org/p/AEMq_9ml1n
package main
import (
"fmt"
"sort"
)
func main() {
rati