Versions Compared

Key

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

...

Submit via OWLSPACE in a single file that is runnable in DrScheme (so all expository answers must be enclosed in comment blocks or commented out using semi-colons.s into one file and submit this one compressed file.

Wiki Markup
The type "natural number" (*N*) in this assignment means the _natural-number_ type defined in the text in Section 11.1.  Your file should include a data definition for *N*. Unless the problem statement stipulates otherwise, the _only_ built-in operations you may use with values of this type or variants (such as {{natural>=1}}) are the constructors, accessors, and recognizers for the type and the {{equal?}} (or {{=}}}) operation.  For *N*, the constructor is {{add1}} ; the accessor is {{sub1}} , and the recognizers are {{zero?}}  and {{positive?}} .


For variants, the constructor is typically {{add1}}  (unless the variant consists of multiples of {{m>1}} \[such as the even numbers\] for which the constructor is {{(+ ... m)}}), the accessor is typically {{sub1}}  ({{(- ... m)}} if the constructor is {{(+ ... m)}}), and the recognizers are typically {{(equal? ... k)}} , where {{k}}  is the base number, ({{zero?}} for *N*), and {{(> ... k)}} ({{positive?}}  for *N*).

Problems from the book (HTDP) with some customization

...