Trapped Rainwater

Given an elevation map of column heights, compute the total volume of water retained between columns after rain. Water at position i is max(0, min(max-left, max-right) - height[i]).

The O(n) two-pointer algorithm walks inward from both ends, advancing whichever pointer has the smaller boundary. The constraining side determines the water level — no scan needed, one pass suffices.

The pure algorithm lives in wal-sh.tools.rainwater.core (host-neutral .cljc, tested on the JVM with test.check: reversal symmetry, non-negativity, upper bound, monotonic profiles trap zero, and agreement with a brute-force O(n²) reference). The browser adapter is wal-sh.tools.rainwater.browser. Build: gmake tools-cljs; debug in isolation: gmake dev-tool TOOL=rainwater.