Question
(@problem 1) ;; CPSC 107 Graded Problem Set 5 ;; ;; For Problem Set 5, you will be working with a program that tracks mentoring
(@problem 1) ;; CPSC 107 Graded Problem Set 5
;; ;; For Problem Set 5, you will be working with a program that tracks mentoring ;; relationships. Like any program, the first thing to think about is how to ;; represent the participant information as data - specifically how to represent ;; a single participant (i.e. mentor and/or mentee) as data. ;; ;; For this problem set, each participant has a name, a list of ;; topics that they are interested in or have expertise in, and a list of ;; participants that they mentor. We'll assume that each person has at most ;; one mentor, even though this isn't true in real life. ;; ;; Please carefully read through the data definition for a participant provided ;; for you below. You should get out a pen and paper to trace out which ;; participants are mentors or mentees to better visualize the structure of ;; participants given in the examples below. ;;
(@htdd Participant ListOfParticipant ListOfString) (define-struct participant (name topics mentees)) ;; Participant is (make-participant String ListOfString ListOfParticipant) ;; interp. a participant with a name, list of topics they have interest or ;; expertise in, and a list of participants that they mentor
;; ListOfParticipant is one of: ;; - empty ;; - (cons Participant ListOfParticipant) ;; interp. a list of participants
;; ListOfString is one of: ;; - empty ;; - (cons String ListOfString) ;; interp. a list of strings
(define LOS0 empty) (define LOS1 (list "interviewing")) (define LOS2 (list "communication skills" "testing" "code reviews")) (define LOP0 empty) (define P0 (make-participant "Xavier Maxwell" (list "testing" "data science") empty)) (define P1 (make-participant "Sarah Jackson" (list "algorithms" "communication skills" "data mining") empty)) (define P2 (make-participant "Ling Xu" (list "writing" "machine learning" "programming") empty)) (define LOP1 (list P1 P2)) (define P3 (make-participant "Ananya Kumar" (list "programming" "writing" "testing" "cybersecurity") LOP1)) (define P4 (make-participant "Ella Mason" (list "data science" "writing" "data mining") (list P3))) (define P5 (make-participant "Ora Jacobson" (list "communication skills" "testing" "interviewing" "code reviews") empty)) (define P6 (make-participant "Sam Hu" (list "programming" "communication skills" "algorithms" "visualization") empty)) (define P7 (make-participant "Mandy Wilson" (list "game development" "programming" "graphical design") empty)) (define P8 (make-participant "James Ploshynsky" (list "machine learning" "AI") (list P5 P6 P7))) (define P9 (make-participant "Ayra Nguyen" (list "programming" "writing" "data science") (list P0 P4 P8)))
#; (define (fn-for-participant p) (... (participant-name p) (fn-for-los (participant-topics p)) (fn-for-lop (participant-mentees p))))
(define (fn-for-lop lop) (cond [(empty? lop) (...)] [else (... (fn-for-participant (first lop)) (fn-for-lop (rest lop)))]))
(define (fn-for-los los) (cond [(empty? los) (...)] [else (... (first los) (fn-for-los (rest los)))]))
;; ;; Mentors may be curious about how many mentees exist in their ;; "mentee tree". ;; ;; Design a function that consumes a participant and produces a count of the ;; number of participants reachable from that participant (including themself) ;; by going through all of their mentees and their mentees' mentees, etc. ;; ;; Remember that for all functions operating on mutually referential types ;; you must group your function definitions in the new way.
;!!! UNCOMMENT this when you start the problem (@htdf count--participant count--lop)
(@problem 2) ;; Perhaps participants want to find participants who ;; have the same interest or expertise, regardless of whether ;; they have a mentor/mentee relationship. ;; ;; Design a function that consumes a participant and a topic, in that order, ;; and produces a list of names of participants with interest or ;; expertise in that topic. ;; ;; There is a built-in function called member that consumes ;; a String and ListOfString and produces true if the String is ;; in the list.
;!!! UNCOMMENT this when you start the problem ;(@htdf has-topic--participant has-topic--lop)
(@problem 3) ;; Perhaps we want to know if a certain participant exists in ;; a participant's mentoring network. ;; ;; Design a function that consumes a participant and a name, in that order. ;; Search the given participant and all mentees eachable from the ;; participant for someone with the given name, and if found, produce ;; that participant.
;!!! UNCOMMENT this when you start the problem ;(@htdf find-participant--participant find-participant--lop)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started