Companion film
One series, three futures
Change one month of units and watch mapped revenue, cumulative totals, and three scenario futures recalculate together.
49 secGrid 0.63.2
Open film page →Canonical Grid model
Portable analytics model built from spills, higher-order functions, and scenarios.
What this model gives you
15 min to study · Source reviewed 2026-08-25
Continue with guided practiceExpected checkpoint
After loading the canonical source with its authored units, prices, and scenario multipliers.
MAP pairs units and prices while SCAN and REDUCE expose both the running path and final total.
Three multipliers cross five months without copying fifteen formulas.
BYROW totals each scenario; BYCOL confirms the symmetric scenario average returns the base month values.
MODEL "Array Analytics"
DESCRIPTION "Portable analytics model built from spills, higher-order functions, and scenarios."
VERSION "1.0.0"
AUTHOR "Grid Team"
TAGS "canonical", "portable", "arrays", "analytics"
# Base series: units and realized price by month
A1 = [120, 135, 142, 150, 168]
A2 = [42, 44, 47, 49, 52]
# Monthly revenue and cumulative revenue
A3 = MAP(A1, A2, (units, price) => ROUND(units * price, 2))
A4 = SCAN(0, A3, (acc, value) => ROUND(acc + value, 2))
A5 = REDUCE(0, A3, (acc, value) => ROUND(acc + value, 2))
A6 = ROUND(A5 / 5, 2)
# Scenario multipliers: bear, base, bull
G1 = [0.92; 1.00; 1.08]
# 3x5 scenario matrix (scenarios x months) built with a comprehension;
# lowers to a single MAKEARRAY cell under the hood.
G5 = [INDEX(A3, 1, month) * INDEX(G1, scenario, 1) FOR scenario IN 1..3, month IN 1..5]
M5 = BYROW(G5, row => SUM(row))
G9 = BYCOL(G5, col => AVERAGE(col))
# Compact outputs
A8 = SUM(A3)
A9 = INDEX(M5, 3) > INDEX(M5, 2) THEN "bull-led" ELSE "base-led"
A10 = `total={A8} avg={A6} scenario={A9}`
END MODEL