Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

That's the most compelling example you could come up with as someone who presumably writes Go?

Reversing a slice of T. Copy and pasting this:

    for i := len(a)/2 - 1; i >= 0; i-- {
        opp := len(a) - 1 - i
        a[i], a[opp] = a[opp], a[i]
    }
New:

    reverse(a)
Or generic versions of these: https://gobyexample.com/collection-functions


Yep, this is exactly the use case I was talking about.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: