Blame


1 12687dd9 2023-08-04 jrmu ;; The first three lines of this file were inserted by DrScheme. They record metadata
2 12687dd9 2023-08-04 jrmu ;; about the language level of this file in a form that our tools can easily process.
3 12687dd9 2023-08-04 jrmu #reader(lib "htdp-intermediate-reader.ss" "lang")((modname 18.1.11) (read-case-sensitive #t) (teachpacks ((lib "draw.ss" "teachpack" "htdp"))) (htdp-settings #(#t constructor repeating-decimal #f #t none #f ((lib "draw.ss" "teachpack" "htdp")))))
4 12687dd9 2023-08-04 jrmu (define-struct star (name instrument))
5 12687dd9 2023-08-04 jrmu
6 12687dd9 2023-08-04 jrmu A star is a structure
7 12687dd9 2023-08-04 jrmu (make-star name instrument)
8 12687dd9 2023-08-04 jrmu where both name and instrument are symbols.
9 12687dd9 2023-08-04 jrmu
10 12687dd9 2023-08-04 jrmu (define alos
11 12687dd9 2023-08-04 jrmu (list (make-star 'Chris 'saxophone)
12 12687dd9 2023-08-04 jrmu (make-star 'Robby 'trumpet)
13 12687dd9 2023-08-04 jrmu (make-star 'Matt 'violin)
14 12687dd9 2023-08-04 jrmu (make-star 'Wen 'guitar)
15 12687dd9 2023-08-04 jrmu (make-star 'Matt 'radio)))
16 12687dd9 2023-08-04 jrmu
17 12687dd9 2023-08-04 jrmu last-occurrence : symbol list-of-star -> star
18 12687dd9 2023-08-04 jrmu Given a-name and a-los, find the last occurrence of a star with a-name in the name field and return this star structure.
19 12687dd9 2023-08-04 jrmu
20 12687dd9 2023-08-04 jrmu (define (last-occurrence a-name a-los)
21 12687dd9 2023-08-04 jrmu (cond
22 12687dd9 2023-08-04 jrmu []
23 12687dd9 2023-08-04 jrmu []))