;; during class, many of you wanted to be able to globally define ;; the person created in add-child-to-mother. Here is a version that ;; lets you do that, with an example of how to use it. ;; add-child-to-mother : person string -> void ;; create new person with given name and mother and add new person to ;; given person's kids ;; EFFECT: changes kids component of given person (define (add-child-to-mother aperson aname) (local [(define childper (make-person aname aperson 'unknown empty))] (begin (set-person-kids! aperson (cons childper (person-kids aperson))) childper))) (define-struct person (name mother father kids)) (define Brendaper (make-person "Brenda" 'unknown 'unknown empty)) (define Judyper (add-child-to-mother Brendaper "Judy")) (define Eddieper (add-child-to-mother Brendaper "Eddie")) (define Fredper (add-child-to-mother Judyper "Fred"))