;; hw04-data.ss
;; A medium-sized family-tree, for use in testing hw04.
;; Note that you should run some test cases in addition to this one.
;;
;; This assumes that
;; (define-struct child (name eyes year mother father))
;; has already been executed, as in class, and that unknown people
;; are represented as 'unknown.
;;
; Gabi Helmut Gabi Helmut
; | | | |
; +-------+ +-------+ Lord-Hasen
; | | |
; Hunko Chantelle Pierre Lady-Pfefferplump
; | | | |
; +--------+ +--------+
; | |
; Bambam Pebbles
; | |
; +----------------------+
; |
; Godzillette
;
; NOTE: We have not seen in Scheme how to distinguish
; between the tree where Pierre and Chantelle are siblings,
; versus when their parent-values are the same.
; (Consider (list 17 17). Does it contain one value
; twice, or two values which happen to be equal?)
;
; If you print out the value godzillette, you will see that
; (make-child 'gabi ...)
occurs twice
; (although you may not have expected that from the statements
; used to create godzillette).
; *** In your homework, your functions would reflect what
; Scheme prints as the value of godzillette:
; namely, there are twelve make-child
values in the tree.
; (If you additionally include a more complicated version
; which assumes people have unique names and doesn't double-count them,
; this is worth some extra credit.)
(define NOBODY 'unknown)
; To match the book rather than lecture, define NOBODY as null instead.
(define gabi (make-child 'gabi 'hazel 1900 NOBODY NOBODY))
(define helmut (make-child 'helmut 'blue 1901 NOBODY NOBODY))
(define pierre (make-child 'pierre 'blue 1920 gabi helmut))
(define chantelle (make-child 'chantelle 'brown 1921 gabi helmut))
(define lordHasen (make-child 'Lord-Hasen 'brows 1872 NOBODY NOBODY))
(define pebbles (make-child
'pebbles
'blue
1940
(make-child 'Lady-Pfefferplump 'brown 1899 NOBODY lardHasen)
pierre))
(define bambam (make-child
'bambam
'blue
1941
chantelle
(make-child 'Hunko 'green 1922 NOBODY NOBODY)))
(define godzillette (make-child 'godzillette 'hazel 1966 pebbles bambam))