Exercise 2.46

in
Printer-friendly versionPrinter-friendly version

A two-dimensional vector 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:

Corresponding Section: 

Comments

/ I egraely await starting mine until I see what you come up with. I can’t wait.I expect the following objective markers: Great Pit of Carkoon, two droids half-stuck in sand.Of course one Raider will have to be crewed by Lando, Han, Luke and Chewie, but you could probably throw Boba Fett on there.

Post new comment

  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <pre> <hr> <ul> <ol> <li> <dl> <dt> <dd> <img>
  • Lines and paragraphs break automatically.
  • Adds typographic refinements.

More information about formatting options