Try it the other way. You'll see it's not so clean. -rob
On Thu, Apr 20, 2017 at 7:47 PM, Ian Lance Taylor <i...@golang.org> wrote: > On Thu, Apr 20, 2017 at 2:14 AM, <zerk...@gmail.com> wrote: > > > > At the moment it is implemented as > > > > 295 func IsSorted(data Interface) bool { > > 296 n := data.Len() > > 297 for i := n - 1; i > 0; i-- { > > 298 if data.Less(i, i-1) { > > 299 return false > > 300 } > > 301 } > > 302 return true > > 303 } > > > > > > Is there any practical (technical) reason for this loop to be > > end-to-beginning, or is it just a preference of someone who implemented > it? > > Robert wrote it in > https://github.com/golang/go/commit/18852cf6d3f23a4fbcf2756836eb92 > 9283126827 > . Let's ask him. It was less than ten years ago. > > 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. > -- 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.