Chapter 2: Problem 46
A two-dimensional vector \(\mathbf{v}\) running from the origin to a point can be represented as a pair consisting of an \(x\)-coordinate and a \(y\)-coordinate. Implement a data abstraction for vectors by giving a constructor make-vect and corresponding selectors xcor-vect and ycor-vect. In terms of your selectors and constructor, implement procedures add-vect, sub-vect, and scale-vect that perform the operations vector addition, vector subtraction, and multiplying a vector by a scalar: $$ \begin{aligned} \left(x_{1}, y_{1}\right)+\left(x_{2}, y_{2}\right) &=\left(x_{1}+x_{2}, y_{1}+y_{2}\right) \\ \left(x_{1}, y_{1}\right)-\left(x_{2}, y_{2}\right) &=\left(x_{1}-x_{2}, y_{1}-y_{2}\right) \\ s \cdot(x, y) &=(s x, s y) \end{aligned} $$
Short Answer
Step by step solution
Key Concepts
These are the key concepts you need to understand to accurately answer the question.