Repetition

Loops, in the shape a worksheet can have them.

A worksheet is a set of definitions with dependencies, not a script. SMath's loops mutate variables inside a statement block, which fights that directly — so what this language provides instead is the three things those loops are actually doing in the corpus, none of which mutates anything.

A range is a vector. This is the loop counter, and on its own it already replaces the commonest for in the corpus.

counts=range⁡(1,5)=[1, 2, 3, 4, 5]

The end is included when the step lands on it, because range(1, 5) has to index a five-element vector.

odd=range⁡(1,9,2)=[1, 3, 5, 7, 9]

Ranges carry a dimension, so tabulating a physical quantity needs no trick.

stations=range⁡(0⁢m,10⁢m,2.5⁢m)=[0 m, 2.5 m, 5 m, 7.5 m, 10 m]

map applies a function to every element. for(k, range(1, n), y[k] <- f(x[k])) is what the corpus writes; this is what it means.

fn area defined
areas=map⁡(area,[2⁢m3⁢m4⁢m])=[4 m², 9 m², 16 m²]

Accumulating a total is map and then sum, not a running variable.

fn moment defined
total=sum⁡(map⁡(moment,stations))=sum⁡(map⁡(moment,[0 m, 2.5 m, 5 m, 7.5 m, 10 m]))=250000⁢J

iterate applies a function a fixed number of times, which is what a convergence loop is. Newton-Raphson for the square root of two:

fn newton defined
root=iterate⁡(newton,1,5)=1.41421

A fixed count rather than a tolerance test, deliberately: it terminates, it takes the same number of steps on every machine, and it cannot spin.