On Friday, May 5, 2017 at 11:57:58 AM UTC+2, Ondřej Kupka wrote:
>
> > Performing separate stable sorts on a partial key does not produce a
> stable sort on the full key.
>
> I think that it does, when you sort from the last key to the first key.
>
>
Intuitively I think too that it does, but
> Performing separate stable sorts on a partial key does not produce a
stable sort on the full key.
I think that it does, when you sort from the last key to the first key.
When I want to sort the slice by (Gateway, Channel, Device),
then sorting by Device, then Channel, then Gateway using a
On Fri, May 5, 2017 at 11:37 AM Ondřej Kupka wrote:
> It seems that the slice is sometimes sorted properly and sometimes it
isn't obviously sorted. How is that possible?
Performing separate stable sorts on a partial key does not produce a stable
sort on the full key.
--
Hi,
I have a slice of points:
type Point strcut {
Gateway string
Channel int
Devce int
}
Now I execute
cc := make([]Point, 0)
// Fill cc with points (skipped here).
sort.SliceStable(cc, func(i, j int) bool {
return cc[i].Device < cc[j].Device
})
sort.SliceStable(cc, func(i,