On Fri, 21 Apr 2017, at 03:31 AM, Ivan Kurnosov wrote:
> @Rob,
> 
> honestly to me they look the same:
> 
> 
> func IsSorted(data Interface) bool {
>     n := data.Len() for i := n - 1; i > ; i-- { if data.Less(i, i-1) {
>        return false } } return true }
>
>
> func IsSortedForward(data sort.Interface) bool {
>     n := data.Len() for i := 1; i < n; i++ { if data.Less(i, i-1) {
>        return false } } return true }> 
> 
> https://play.golang.org/p/KSwwMk67ew

How well does this handle slices of length 0 and 1?

Ian

> 

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to