make?

Artem 2016-03-03 18:51:50 +03:00
parent 4a4abf8262
commit b891cf35f0

@ -68,14 +68,14 @@ Slice elements are almost identical to variables. Because they are addressable,
Map elements are not addressable. Therefore, the following is an _illegal_ operation: Map elements are not addressable. Therefore, the following is an _illegal_ operation:
```go ```go
lists := map[string]List lists := map[string]List{}
lists["primes"].Append(7) // cannot be rewritten as (&lists["primes"]).Append(7) lists["primes"].Append(7) // cannot be rewritten as (&lists["primes"]).Append(7)
``` ```
However, the following is still valid (and is the far more common case): However, the following is still valid (and is the far more common case):
```go ```go
lists := map[string]*List lists := map[string]*List{}
lists["primes"] = new(List) lists["primes"] = new(List)
lists["primes"].Append(7) lists["primes"].Append(7)
count := lists["primes"].Len() // can be rewritten as (*lists["primes"]).Len() count := lists["primes"].Len() // can be rewritten as (*lists["primes"]).Len()