Why does this code not compile: https://play.golang.org/p/f5fMvO8Ns7
package main
import (
"fmt"
)
func f(items ...interface{}) {
fmt.Println(items)
}
func main() {
f("a", "b", "c")
tab := []interface{}{"d"}
f("a", "b", "c", tab...)
}
The spec says:
> Otherwise, the value passed is a
er 2017 at 12:59, Jesse McNelis wrote:
> On Fri, Dec 15, 2017 at 8:18 AM, Ivan Kurnosov wrote:
> > Why does this code not compile: https://play.golang.org/p/f5fMvO8Ns7
> > func f(items ...interface{}) {
> > fmt.Println(items)
> > }
>
> The spec also says:
>
>
@Rob,
honestly to me they look the same:
func IsSorted(data Interface) bool {
n := data.Len()
for i := n - 1; i > 0; i-- {
if data.Less(i, i-1) {
return false
}
}
return true
}
func IsSortedForward(data sort.Interface) bool {
n := data.Len()
f
Speaking low level - how about memory prefetch algorithms (os, hardware)?
Do they work equally good when one iterates backward?
On Friday, April 21, 2017 at 3:50:39 PM UTC+12, andrey mirtchovski wrote:
>
> > 297 for i := n - 1; i > 0; i-- {
>
> "i > 0" is cheaper than "i < n" on some processors
1. Convert it to a number
2. Use `rune()`
On Sunday, April 23, 2017 at 6:51:09 AM UTC+12, Tong Sun wrote:
>
> Hi,
>
> Given a unicode code string, be it "4e16", or "0x4e16", or "u4e16", how to
> turn it into a single char rune?
>
> You can finish the code at https://play.golang.org/p/AFIEz3eJVz