Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

We've seen lists of symbols and lists of numbers; you can of course have a list with elements of any given type...including other structures like

HTML
<tt>

posn

HTML
</tt>

posn-s. This just uses ideas you've already learned, but in new contexts.

  1. Define the type of lists of
    HTML
    <tt>
    posn
    HTML
    </tt>
    posn-s.
  2. Write the templates of lists of
    HTML
    <tt>
    posn
    HTML
    </tt>
    posn-s. (NB: There are two non-primitive types here, one inductive the other a structure. So this may require two templates or one, depending on if you believe in structure templates.)
  3. Write the function positive-quadrant? , which takes in a single posn and returns true only when its components are both positive.
  4. Develop count-positive-quadrant , which takes a list of
    HTML
    <tt>
    posn
    HTML
    </tt>
    posn-s and returns a count of those in the upper-right quadrant.
  5. Develop filter-positive-quadrant , which takes a list of
    HTML
    <tt>
    posn
    HTML
    </tt>
    posn-s and returns a list of those in the upper-right quadrant.

...