programextensions/sqlite/demos/notebook.xtl
The data notebook: a CSV in SQLite, SQL to select and group, X_eTaL arrays to compute, pictures to see it. Atmospheric CO2 at Mauna Loa, 1959-2025 (NOAA GML and Scripps; demos/data/PROVENANCE.txt). Run: just demo sqlite notebook (pictures go to work/draw/)
db : Char
db ← "work/notebook.db"
n : Int
n ← db sq:i̲mport "co2=demos/data/co2-mlo-annual.csv"
3. arrays: the whole series, then what SQL is awkward at
d : Float
the rise each year: the series minus itself shifted by one
d ← (1 d̲rop c) − -1 d̲rop c
Used in: extensions/sqlite/demos/notebook.xtl:31, b
s : Float
s ← ('+ r̲/ (y − yb) × c − cb) ÷ '+ r̲/ (y − yb) × y − yb
Used in: extensions/sqlite/demos/notebook.xtl:38, e
e : Float
the line misses in a curve: high at both ends, low in the middle -- the rise is speeding up (residuals averaged by thirds)
e ← c − cb + s × y − yb
Used in: k, extensions/sqlite/demos/notebook.xtl:45
4. pictures
b : Int
the yearly rise as a histogram: half-ppm bins, one column per bin, drawn as an APL bar chart (a 0/1 matrix, 1s dark)
b ← 1 + f̲loor d ÷ 0.5
Used in: h