flâneur — a map of the web's best reading

CSC 151 - Transforming lists

eikmeier.sites.grinnell.edu · 1,628 words · saved by 1 readers

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