Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(1967)

Side by Side Diff: content/go-slices-usage-and-internals.article

Issue 9960043: code review 9960043: go.blog: update tags (Closed)
Patch Set: diff -r 5fbc5fc21e6e https://code.google.com/p/go.blog Created 11 years, 10 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « content/go-programming-session-video-from.article ('k') | content/go-turns-three.article » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 Go Slices: usage and internals 1 Go Slices: usage and internals
2 5 Jan 2011 2 5 Jan 2011
3 Tags: slice 3 Tags: slice, technical
4 4
5 Andrew Gerrand 5 Andrew Gerrand
6 6
7 * Introduction 7 * Introduction
8 8
9 Go's slice type provides a convenient and efficient means of working with sequen ces of typed data. Slices are analogous to arrays in other languages, but have s ome unusual properties. This article will look at what slices are and how they a re used. 9 Go's slice type provides a convenient and efficient means of working with sequen ces of typed data. Slices are analogous to arrays in other languages, but have s ome unusual properties. This article will look at what slices are and how they a re used.
10 10
11 * Arrays 11 * Arrays
12 12
13 The slice type is an abstraction built on top of Go's array type, and so to unde rstand slices we must first understand arrays. 13 The slice type is an abstraction built on top of Go's array type, and so to unde rstand slices we must first understand arrays.
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 c := make([]byte, len(b)) 224 c := make([]byte, len(b))
225 copy(c, b) 225 copy(c, b)
226 return c 226 return c
227 } 227 }
228 228
229 A more concise version of this function could be constructed by using `append`. This is left as an exercise for the reader. 229 A more concise version of this function could be constructed by using `append`. This is left as an exercise for the reader.
230 230
231 * Further Reading 231 * Further Reading
232 232
233 [[http://golang.org/doc/effective_go.html][Effective Go]] contains an in-depth t reatment of [[http://golang.org/doc/effective_go.html#slices][slices]] and [[htt p://golang.org/doc/effective_go.html#arrays][arrays]], and the Go [[http://golan g.org/doc/go_spec.html][language specification]] defines [[http://golang.org/doc /go_spec.html#Slice_types][slices]] and their [[http://golang.org/doc/go_spec.ht ml#Length_and_capacity][associated]] [[http://golang.org/doc/go_spec.html#Making _slices_maps_and_channels][helper]] [[http://golang.org/doc/go_spec.html#Appendi ng_and_copying_slices][functions]]. 233 [[http://golang.org/doc/effective_go.html][Effective Go]] contains an in-depth t reatment of [[http://golang.org/doc/effective_go.html#slices][slices]] and [[htt p://golang.org/doc/effective_go.html#arrays][arrays]], and the Go [[http://golan g.org/doc/go_spec.html][language specification]] defines [[http://golang.org/doc /go_spec.html#Slice_types][slices]] and their [[http://golang.org/doc/go_spec.ht ml#Length_and_capacity][associated]] [[http://golang.org/doc/go_spec.html#Making _slices_maps_and_channels][helper]] [[http://golang.org/doc/go_spec.html#Appendi ng_and_copying_slices][functions]].
OLDNEW
« no previous file with comments | « content/go-programming-session-video-from.article ('k') | content/go-turns-three.article » ('j') | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b