まず、構造を定義します。
(define-struct animal (name species age breakfast-hour dinner-hour))
(define-struct attendant (name a1 a2 a3))
次に、動物 (アテンダントに割り当てる前にこれらを作成する必要があるため):
(define gorilla (make-animal "Koko" "Gorilla" 4 8 10))
(define bat (make-animal "Bruce" "Bat" 1 23 5))
(define mandrill (make-animal "Manny" "Mandrill" 5 8 10))
(define crocodile (make-animal "Swampy" "Crocodile" 1 10 18))
(define ocelot (make-animal "Ozzy" "Ocelot" 7 7 17))
(define capybara (make-animal "Capy" "Capybara" 4 6 18))
(define potto (make-animal "Spot" "Potto" 2 2 6))
(define tapir (make-animal "Stripey" "Tapir" 3 10 17))
(define vulture (make-animal "Beaky" "Vulture" 10 9 19))
最後に、アテンダントを作成し、それぞれの男性または女性に対応する動物を与えます。
(define attendant1 (make-attendant "Dave" gorilla bat mandrill))
(define attendant2 (make-attendant "John" crocodile ocelot capybara))
(define attendant3 (make-attendant "Joe" potto tapir vulture))
アテンダントを作成するには、以前に定義した動物の 1 つを参照する必要があることに注意してください。