Loading lesson…
Level 1 · Apprentice0 XP
Read-only versus mutable, the operations you will use every day, and when to go lazy.
Step 1 / 5
ProblemA function returns its internal list. A caller adds an element. The owner's state is now wrong and nothing in the signatures warned anyone.
← → step
Before this: Higher-order functions and lambdas
🛠️ Your turn
Reading is not the skill, doing is. Try for ten minutes before you open the hint. Getting stuck first is what makes the solution stick.
1.Given a list of orders (customer, total, paid), compute in one expression each: the total paid revenue, the three biggest customers by spend, and a map from customer to their number of unpaid orders. Then make the second one lazy with a sequence.