Practicing iterative processing without structured loops
As stated in the previous section, as well as in Chapter 3, Bosque Key Features, in order to perform iteration, we need to utilize ready-to-use methods depending on the task we are solving and the data structure we use. In this section, we will play with the List
concept and see how we can iterate over it in various ways and solve a few practical problems.
Multiplying vectors
The first problem we are going to solve is the multiplication of vectors. However, before we jump into the code, let's clarify how we multiply vectors in the first place.
Let's begin by explaining what a vector actually is. Since this book is not a mathematics textbook, I won't provide you with a formal definition. For the sake of this example, it's enough to know that a vector is a set of n numeric components. In programming, vectors can be represented as arrays of numbers. In Bosque, we can represent a vector using a tuple...