Versions Compared

Key

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

Homework 2 (Due

...

Friday 1/

...

29/09 at

...

10:00

...

am)

Submit via OWLSPACE . "Zip" (compress) all your solution files 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 MarkupA "Natural number" \ ( {{natural=\) in this assignment means the type defined in the text. Your file should include a data definition for =natural}} . Unless the problem statement stipulates otherwise, the _only_ built-in operations you may use with values of this type or variants \ (such as {{natural\[>as natural>=1\]=\) are the constructors, accessoraccessors, and recognizers for the type and the =equal?}} (or =}) operation. For {{natural}} , the constructor is {{add1}} ; the accessor is {{sub1}} , and he recognizers are {{zero?}} and {{positive?}} .
For variants, the constructor is typically {{add1}} \ (unless the variant consists of multiples of {{m}} for {{m>1}} such as the even numbers for which the constructor is {{add2=\), the accessor is typically =sub1}} \ ( {{subk}} if the constructor is {{addk=\), and the recognizers are typically is =\(equal? ... k\)}} , where {{k}} is the base number \, ( {{zero?}} for {{natural=\), and =\(> ... k\)}} \ ( {{positive}} for = natural=\).

Problems from the book (HTDP) with some customization:

...