We all saw it immediately ... because ... we remember having done it too.
:-)
On Tue, Apr 10, 2018 at 11:38 AM, Sankar wrote:
> ah damn. Thanks everyone :)
>
> On Wednesday, 11 April 2018 00:05:00 UTC+5:30, Jan Mercl wrote:
>>
>>
>> On Tue, Apr 10, 2018 at 8:29 PM
ah damn. Thanks everyone :)
On Wednesday, 11 April 2018 00:05:00 UTC+5:30, Jan Mercl wrote:
>
>
> On Tue, Apr 10, 2018 at 8:29 PM Sankar > wrote:
>
> > Any help on how I can get arr sorted in the above code ?
>
> Just a typo: https://play.golang.org/p/vhbo8OIrh-H
>
> --
On Tue, Apr 10, 2018 at 8:29 PM Sankar wrote:
> Any help on how I can get arr sorted in the above code ?
Just a typo: https://play.golang.org/p/vhbo8OIrh-H
--
-j
--
You received this message because you are subscribed to the Google Groups
"golang-nuts" group.
Simple mistake.
You have:
sort.Slice(arr, func(i, j int) bool {
return arr[i].X < arr[i].X
})
Instead use:
sort.Slice(arr, func(i, j int) bool {
return arr[i].X < arr[j].X
})
On Tue, Apr 10, 2018 at 12:28 PM, Sankar wrote:
> Hi
>
> I have the following code:
>
>
Change I i to I j
On Tue, Apr 10, 2018 at 11:29 AM Sankar wrote:
> Hi
>
> I have the following code:
>
> type Point struct {
> Xint
> Name string
> }
>
> arr := []Point{
> Point{1, "One"},
> Point{3, "Three"},
> Point{2, "Two"},
> Point{4, "Four"},
> }
>
>
Hi
I have the following code:
type Point struct {
Xint
Name string
}
arr := []Point{
Point{1, "One"},
Point{3, "Three"},
Point{2, "Two"},
Point{4, "Four"},
}
log.Println("Before Sorting: ", arr)
sort.Slice(arr, func(i, j int) bool {
return arr[i].X < arr[i].X
})
log.Println("After Sorting:
Or:
sort.Sort(Courses(course))
On Tuesday, September 20, 2016 at 10:50:15 AM UTC-7, Jan Mercl wrote:
>
> Types []Course and Courses are distinct types. courses have type []Courses
> because that's what the parameter to make is. Change it to Courses, ie.
>
> courses := make(Courses, maxrow)
>
>
Types []Course and Courses are distinct types. courses have type []Courses
because that's what the parameter to make is. Change it to Courses, ie.
courses := make(Courses, maxrow)
On Tue, Sep 20, 2016, 19:44 Arie van Wingerden wrote:
> Hi,
>
> Still a beginner ... first take
Hi,
Still a beginner ... first take at a bit more difficult thing.
I cannot get this https://play.golang.org/p/qgBLH0r_vq to work.
Compiler says:
cannot use courses (type []Course) as type sort.Interface in argument to
sort.Sort:
[]Course does not implement sort.Interface (missing Len