๐ WAYPOINT LESSON
Checkpoint โ The Analytics Engine
โญโญ intermediateโณ 25 min read๐ Lesson 112 of 265
Combine grouping, joining, and aggregation into one report with honest single-pass semantics.
The gate (mini-build)
A tiny sales analytics engine over in-memory rows:
Revenue(IEnumerable<Sale> sales)โ total revenue (decimal).BestCategory(IEnumerable<Sale> sales)โ category name with the highest revenue (ties: earliest alphabetically).CustomerMatrix(IEnumerable<Sale> sales, IEnumerable<string> customers)โ per-customer totals in the ORDER GIVEN (zero for customers with no sales), formatted "name=total".Run(IEnumerable<Sale> sales, IEnumerable<string> customers)โ a report string combining all three, computed from ONE enumeration of sales (graded with a counting source โ a second pull fails).
Sale record: (string Customer, string Category, decimal Amount).