CSC 151 - Transforming lists
Imagine representing the collection of yearly salaries found at a startup using a simple list, for example: And now imagine computing everyone’s updated salary after a standard cost-of-living adjustment (COLA). We might decompose this problem into the problem of computing one person’s updated salary. Let’s take the first person whom makes 100000 (units deliberately unspecified) as an example. The Social Security COLA for 2020 was %1.6, so we can calculate the updated salary using arithmetic: And we can abstract this into a function that computes the updated salary when given a salary: Good! We can now calculate the updated salary for any person. However, how do we do this for a collection of salaries, a collection represented as a list? Note that the calculation of each salary is independent of the other salaries. That is, someone’s adjusted salary only depends on their salary and not other salaries. In this situation, we simply want to apply our solution for a single person, compute-c
CSC 151 - Transforming lists Transforming lists Due Monday, 15 September 2025 --> Summary We investigate a particular form of decomposition relevant in computing in which transformations over a collection of values are really transformations of the individual elements of the collection. Imagine representing the collection of yearly salaries found at a startup using a simple list, for example: (define salaries (list 100000 100000 50000 75000 500000)) And now imagine computing everyone’s updated salary after a standard cost-of-living adjustment (COLA). We might decompose this problem into the pr
Explore this link on the map →saved by
related reading
- CSC 151 - The "big three" list operationseikmeier.sites.grinnell.edu
- CSC 151 - List basicseikmeier.sites.grinnell.edu
- CSC 151 - Higher-order design, recursive and othereikmeier.sites.grinnell.edu
- CSC 151 - Coding Challenge 4eikmeier.sites.grinnell.edu
- CSC 151 - Recursion Over Listseikmeier.sites.grinnell.edu
- CSC 151 - Coding Challenge 6eikmeier.sites.grinnell.edu
- CSC 151 - Analyzing procedureseikmeier.sites.grinnell.edu
- CSC 151 - Reading data from fileseikmeier.sites.grinnell.edu
- CSC 151 - Coding Challenge 8eikmeier.sites.grinnell.edu
- CSC 151 - Tail Recursioneikmeier.sites.grinnell.edu
- CSC 151 - Anonymous procedureseikmeier.sites.grinnell.edu
- Clean Coder Blogblog.cleancoder.com