This library is in flux. APIs may change without notice. Generated from source with koruc 0.1.7 on 8/19/2026.

Table

~import std/table

Koru Standard Library: Table comprehensions

table.kz · 3 tors · ~[comptime]

Koru Standard Library: Table comprehensions · 19 more lines
Koru Standard Library: Table comprehensions `from(name) { <var> over <lo>..<hi> }` bakes a `const` table at COMPILE TIME from a restricted, closed comprehension — the regex->DFA move generalized from strings to data. Pure-Koru SURFACE (no `` at the call site); the comprehension is EVALUATED by the `table_from` Zig filter (template_processor.zig) and EMITTED as a const array, exactly as `const` emits scalars via `parse_fields`. Both the |zig and |js variants call the SAME filter, so the two lowerings of one comprehension cannot drift — one source, two targets. v1: generator-only integer ranges (`x over 1..4` -> [1, 2, 3], upper-exclusive, matching the sieve's `for(2..1001)`). Next: `keep <guard>` filters + reduce monoids; the pure-Koru #loop evaluator (pin 310_091) is the flex that replaces the Zig filter underneath. See docs/std_field_castles_vision.md. Signature precedent: std/types:enum/union take `{ expr: Expression, source: Source }` (the `name(paren) { block }` shape); emission precedent: `const` (declarations.kz), a `[keyword|declaration]` `[template]` proc that splices a const decl into the enclosing scope where sibling flows see it.

from

keyworddeclaration koru_std/table.kz:24

sum

keyworddeclaration koru_std/table.kz:39

gaps

keyworddeclaration koru_std/table.kz:54