Language

Iteration

xs * x … ..

The * operator walks a sequence. Inside the loop body, you can bind, guard, and update accumulators.

@ sum_sq : a
    total ~ 0
    a["xs"] * x
        total ~ (total + (x * x))
    ..
    (total >> se_ok) ->
..

{"xs": [1, 2, 3, 4, 5]} >> sum_sq >> print   ~~ 55

Rebinding a name with ~ inside a loop updates the enclosing scope's binding — it is not a new local. This is how Signum expresses fold-style accumulations without mutable state at the language surface: the backend compiles it to a single-slot update.

Guarded iteration

@ count_fevers : a
    hits ~ 0
    a["obs"] * o
        ? ((o["kind"] = "fever") and (o["temp"] > 38))
            hits ~ (hits + 1)
        ..
    ..
    (hits >> se_ok) ->
..