Re: [go-nuts] sort string slice like it contains key,val

2021-03-13 Thread Vasiliy Tolstov
вс, 14 мар. 2021 г. в 00:41, Robert Engels : > > That wasn’t specified in the assignment :) =) As always after first stuff i need the second =) > > On Mar 13, 2021, at 2:59 PM, Levieux Michel wrote: > >  > Your need is not only to sort your data elements then..? > Using the previously advised

Re: [go-nuts] sort string slice like it contains key,val

2021-03-13 Thread Vasiliy Tolstov
I think that remove after sort is good for me, thanks сб, 13 мар. 2021 г. в 23:59, Levieux Michel : > > Your need is not only to sort your data elements then..? > Using the previously advised solution you can just range the slice *after* > you sort it, so you can just check for the next element,

Re: [go-nuts] sort string slice like it contains key,val

2021-03-13 Thread Robert Engels
That wasn’t specified in the assignment :) > On Mar 13, 2021, at 2:59 PM, Levieux Michel wrote: > >  > Your need is not only to sort your data elements then..? > Using the previously advised solution you can just range the slice *after* > you sort it, so you can just check for the next

Re: [go-nuts] sort string slice like it contains key,val

2021-03-13 Thread Levieux Michel
Your need is not only to sort your data elements then..? Using the previously advised solution you can just range the slice *after* you sort it, so you can just check for the next element, which I'd say is not *too bad*, what are your performance constraints? Le sam. 13 mars 2021 à 21:33, Vasiliy

Re: [go-nuts] sort string slice like it contains key,val

2021-03-13 Thread Vasiliy Tolstov
Looks fine =) But how to remove duplicates? I'm found this stuff https://github.com/campoy/unique/blob/master/unique.go but as i understand it needs to adapt to my case =) сб, 13 мар. 2021 г. в 16:47, 'Carla Pfaff' via golang-nuts : > > On Saturday, 13 March 2021 at 14:44:05 UTC+1

Re: [go-nuts] sort string slice like it contains key,val

2021-03-13 Thread 'Carla Pfaff' via golang-nuts
On Saturday, 13 March 2021 at 14:44:05 UTC+1 mlevi...@gmail.com wrote: > the sort package from the stdlib, it contains an interface that you can > easily implement for such problematics :) > Like this: https://play.golang.org/p/eoLJ2aVAWkD -- You received this message because you are

Re: [go-nuts] sort string slice like it contains key,val

2021-03-13 Thread Levieux Michel
Hi, You should take a look at the sort package from the stdlib, it contains an interface that you can easily implement for such problematics :) Hope this helps! Le sam. 13 mars 2021 à 14:37, Vasiliy Tolstov a écrit : > Hi! > I'm stuck at sorting stuff like > >

[go-nuts] sort string slice like it contains key,val

2021-03-13 Thread Vasiliy Tolstov
Hi! I'm stuck at sorting stuff like []string{"xxxkey","xxxval","zzzkey","zzzval","aaakey","aaaval","zzzkey","val"} i need to get after sorting something like []string{"aaakey","aaaval", "xxxkey","xxxval","zzzkey","val"} So i'm sort by "key" and if key is duplicated - last wins. Mostly i