;; The first three lines of this file were inserted by DrRacket. They record metadata ;; about the language level of this file in a form that our tools can easily process. #reader(lib "htdp-beginner-reader.ss" "lang")((modname 03conspiracy-full) (read-case-sensitive #t) (teachpacks ((lib "universe.rkt" "teachpack" "2htdp") (lib "image.rkt" "teachpack" "2htdp"))) (htdp-settings #(#t constructor repeating-decimal #f #t none #f ((lib "universe.rkt" "teachpack" "2htdp") (lib "image.rkt" "teachpack" "2htdp"))))) #| **Data description**\ A _person is a structure: (make-person first last) where `first` and `last` are strings A _conspiracy_ is either - A structure: (make-cell head recruits1 recruits2) where - `head` is a person - `recruits1` is a conspiracy - `recruits2` is a conspiracy - A structure (make-no-recruits) And **DRAW THE ARROWS** We need |# (define-struct person (first last)) (define-struct cell (head recruits1 recruits2)) (define-struct no-recruits ()) (define NR (make-person "Norman" "Ramsey")) (define AB (make-person "Ali" "Boreiko")) (define JA (make-person "Jordan" "Abosch")) (define MB (make-person "Michelle" "Bornstein")) ;; how-many : conspiracy -> number ;; to return the number of persons in the conspiracy ;; EXAMPLES? (define (how-many? c) (cond [(no-recruits? c) 0] [(cell? c) (+ 1 (how-many? (cell-recruits1 c)) (how-many? (cell-recruits2 c)))])) (check-expect (how-many? (make-no-recruits)) 0) (check-expect (how-many? (make-cell NR (make-cell AB (make-no-recruits) (make-no-recruits)) (make-cell JA (make-no-recruits) (make-no-recruits)))) 3)