A3 — Higher-order functions
Implement map, filter, and reduce from scratch, then use them to solve three small data-processing tasks.
Overview
Get comfortable with functions as values.
Part A — Build the primitives
In hof.py, implement my_map(f, xs), my_filter(p, xs), and my_reduce(f, xs, init). No use of the built-ins.
Part B — Apply them
Given records.csv from the starter repo:
- Compute the mean grade.
- Return the names of students who scored above the mean.
- Return the top-3 by score.
You may only iterate with the primitives you built in Part A.