Re: [go-nuts] Why Doesn't "len()" Work With Structs?

2021-10-25 Thread 'burak serdar' via golang-nuts
On Sun, Oct 24, 2021 at 12:12 PM jlfo...@berkeley.edu < jlforr...@berkeley.edu> wrote: > I noticed that the len() function doesn't take a struct as an argument > (see below). > This is a big surprise. Can someone shed some light on why this > restriction exists? > len() gives the number of

Re: [go-nuts] Why Doesn't "len()" Work With Structs?

2021-10-24 Thread Jan Mercl
On Sun, Oct 24, 2021 at 8:11 PM jlfo...@berkeley.edu wrote: > I noticed that the len() function doesn't take a struct as an argument (see > below). > This is a big surprise. Can someone shed some light on why this restriction > exists? What is the expected value of len() when applied to a

[go-nuts] Why Doesn't "len()" Work With Structs?

2021-10-24 Thread jlfo...@berkeley.edu
I noticed that the len() function doesn't take a struct as an argument (see below). This is a big surprise. Can someone shed some light on why this restriction exists? Cordially, Jon Forrest -- package main import "fmt" var s struct { i1 int i2 int } func