Step: Fold with reduce
Fold with reduce
reduce accumulates a stream into one value:
It starts from <init> and runs <update> for each $item, with . holding the accumulator.
Why it matters: reduce expresses aggregations add/map can't — running totals, custom merges, building an object as you go.
Your turn: sum the product prices with reduce (same total as add, but built by hand).
Input:
Expected:
Step 24 of 27