September 2017
Beginner to intermediate
304 pages
7h 2m
English
A vector is an ordered collection of numbers arranged in either a row (left to right) or column (up and down). Each of the numbers in a vector is called a component. This might be, for example, a collection of numbers that represents our company sales, or it might be a collection of numbers representing temperatures.
It's, of course, natural for us to use Go slices to represent these ordered collections of data, as follows:
// Initialize a "vector" via a slice.var myvector []float64// Add a couple of components to the vector.myvector = append(myvector, 11.0)myvector = append(myvector, 5.2)// Output the results to stdout.fmt.Println(myvector)
Slices are indeed ordered collections. However, they don't really represent the concept of ...
Read now
Unlock full access