...
A "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>=1
) are the constructors, accessors, 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
(+ ... m)
), the accessor is typically sub1
(subk
(- ... m)
if the constructor is addk
(+ ... m)
), and the recognizers are typically (equal? ... k)
, where k
is the base number, (zero?
for natural
), and (> ... k)
(positive?
for natural).
Problems from the book (HTDP) with some customization
...