Assignment 2: MyFace
Thanks to Mike Gennert for the assignment this is based on.
You will be submitting this assignment for electronic grading by Thursday October 14th. You must submit a file named my-face.rkt.
The Goals
- Make sure you can write programs over lists of structures
- Practice using map and filter as appropriate
- Practice using helper functions
The Assignment
You should be using map and filter when it is possible to do so keeping in mind that not all functions can use them. Use helpers to increase readability. Don’t forget your signatures! I will be looking for consistent indentation, boolean zen, good helpers, etc.
- A
profileconsists of a member’s name, age, the school s/he attends, and a list of activities s/he participates in. Anetworkis a list ofprofiles.Write data definitions and provide examples of data for activities list, profile, and network. - Write a function
membersthat consumes a network and produces a list of all the members’ names. - Write a function
active-membersthat consumes a network and produces a list of names of members who engage in 3 or more activities. - Write a function
schoolsthat consumes a network and produces a list of all the schools attended. No school may appear more than once. - Write a function
count-members-at-schoolthat consumes a school name and a network and produces the number of members at that school. - Write a function
average-agethat consumes a network and produces the average age of its members. Assume that the network is non-empty. - Write a function
same-activitiesthat consumes 2 people’s names and a network and produces a list of those activities that both participate in. - It is important that MyFace protect the information of young members. Write a function
create-profilethat consumes the same data asmake-profileand produces a profile. If the member’s age is less than 14, the name in the returned profile is left blank, otherwise the name that is supplied is used. This is a common technique for adding data checking features to constructors. - Write a function
add-activity-to-memberthat consumes an activity and a profile and returns a profile that includes the activity. If the activity is already present, it is not repeated. - MyFace realizes that some members have forgotten to include “MyFace” as an activity. Write a function
add-activity-to-everyonethat consumes an activity and a network and produces a network where every member participates in that activity exactly once. - A nearby school has decided to change its name. Rather than update all student profiles individually, write a function
rename-schoolthat consumes two school names and a network, producing a network in which everyone who formerly attended the first school now attends the second and everyone else is as before.






