Programming with
Complete the following exercises. Don't forget to write check-expects.
Person, where a Person has a name (string), eye color (symbol), mother (family tree) and father (family tree).
count-persons that consumes a family tree and produces the total number of people in that tree.
count-gens that consumes a family tree and produces the number of generations in that tree.
get-eye-colors that consumes a family tree and produces a list of all the eye colors that appear in that tree (duplicates are ok).
append, which consumes any number of lists and concatenates them.
For the following problems, use higher-order functions
remove-below-ten that consumes a list of numbers and produces a list with all the numbers below ten removed.
count-persons that consumes a family tree and produces the total number of people in that tree.
say-hello-to-all that consumes a list of strings and produces a list of strings with the string "Hello, " added to the front of each.
Person that contains a string name and non-negative integer age
sort-by-age that takes a list of people and sorts them from oldest to youngest. Now, youngest to oldest (sort-by-age2).
sort-by-name that takes a list of people and sorts them alphabetically by name.
sum-ages that accepts a list of Persons and sums the ages in the list.
Persons. Write a function that accepts a list of Persons and determines whether you can serve alcohol at the party (are all Persons in the list at least 21? Call the function all-over-21?)
Persons and determines if there is at least one person above the age of 21. Call this function at-least-one-over-21?.
Call a TA over to come check your work. If you get checked off, you are free to go!