;; A 3mechs is ;; (make-3mechs ) ;; (define-struct 3mechs (recent two-ago three-ago)) ; Example of data: ; (make-3mechs 'Mike 'Patty 'Bubba) ; Template: ; #| (define (process-3mech a-3m) ..(3mechs-recent a-3m)..(3mechs-two-ago a-3m)..(3mechs-three-ago a-3m)..) |# ;; update-mechs: 3mechs, symbol --> 3mechs #| (define (update-mechs a-3m newest-mech) ..(3mechs-recent a-3m)..(3mechs-two-ago a-3m)..(3mechs-three-ago a-3m)..) |# #| ; Tests (process-3mech (make-3mechs 'Mike 'Patty 'Bubba) 'Mike) = (make-3mechs 'Mike 'Mike 'Bubba) ; ian: sentinels ; Better soln: ;; A symbol-or-false is ;; - a symbol, or ;; - false ;; ;; A 3mechs is: ;; (make-3mechs ) |# #| ;; A structure for a cons ("constructed list"): (define-struct cons (first rest)) ;Examples of data: (make-cons 'Bubba empty) ; Data definition for List-of-Symbols: ;; A List-of-Symbols is either ;; - empty, or ;; - (make-cons ) ;; Examples of data: empty (make-cons 'Bubba empty) (make-cons 'Mike (make-cons 'Patty (make-cons 'Bubba empty))) ; How would you get Mike out of this list? ; How would extract Patty out of this list? ;; Trick question: ;(cons-first empty) ;(cons-rest empty) |# ;; times-served : list-of-symbols -> number ;; Determine the length of the list of mechanics' names. ;; (define (times-served mechs) ...) ; Examples: ;