21. Worksheet C

Create a new struct to hold a number and a posn.

You are going to create a new struct np that remembers both a number and a posn.

  1. Data definition: write a human-understandable description for np.

  2. Write the Racket code to define the np structure.

  3. Write two check-expect to verify that you get out the same information that you put in to the structure.

  4. Design and test np-set-num: np(old) number -> np(new) that sets the number in a given number-position structure.

  5. Design and test np-set-posn: np(old) posn -> np(new) that makes the posn of the np into the given posn.

  6. Go do Exercise 21.6.3 using the idea from this worksheet.

Last modified August 18, 2023: 2022-2023 End State (7352e87)