Please follow the notations described in section 2.5: for each function please write a contract, a purpose, examples, and tests with expected values (drawing functions don't need test cases or examples, but still need a contract and a purpose). Also please write data definitions for structures, i.e. specify the types of all the fields.
The hangman problem, i.e. exercises 6.7.1, 6.7.2, and 6.7.3 in Section 6.7. Some important notes:
(draw-next-part 'noose)
The second one is the result of a sequence
(draw-next-part 'noose)
(draw-next-part 'head)
(draw-next-part 'body)
(draw-next-part 'right-arm)
(draw-next-part 'left-arm)
The third one is the result of all 7 calls.
word
that
contains three letters (as symbols). Assuming that the first letter field
is called letter1
, one of your test examples may be:
(word-letter1 (make-word 's 'u 'n))
;; expected value
's
Note that it's up to you how you call the three fields, but the structure
itself must be called word
.
reveal
must work with the test examples
in the book. reveal
if your top-level
operation in the function is make-word
. Then you just need to
figure out each letter according to the given rules (use
conditionals). Writing helper functions would make the task easier.
(hangman make-word reveal draw-next-part)