Skip to content

Expressions and computations ​

The forms below are grammar templates, not independently runnable programs.

Preparation and scope ​

text
First compute EXPRESSION. Then compute EXPRESSION. Then COMPUTATION

Preparations run once in authored order. A compatible vocabulary-declared phrase, such as that copy, or generic that computed value references the stored result. Without preparation, concept use evaluates independently each time. Preparations admit scalars, constructed sequences, and compatible integer/sequence concepts; pair results cannot be prepared.

Scalar, pair, sequence, and row expressions ​

Supported scalar forms include one, visible integer references, that value in occurrence scope, accumulated state, parameterized and unparameterized integer concepts, length, indexed reads, checked add/subtract/divide, and pair projections.

text
the value at position SCALAR in SEQUENCE
the pair consisting of SCALAR and SCALAR
the first component of PAIR
the second component of PAIR
the sum of SCALAR and SCALAR using checked addition
the difference of SCALAR and SCALAR using checked subtraction
the quotient of SCALAR and SCALAR using checked division

Arithmetic is signed int64. Addition and subtraction detect overflow. Division truncates toward zero and rejects zero plus MinInt64 / -1. Indexed reads evaluate position once and check 0 <= position < length. Length must fit int64.

Sequence forms include existing visible sequences, compatible sequence concepts, an empty sequence, constructed sequences, and checked nested-row selection:

text
the sequence consisting of SCALAR [followed by SCALAR]... values
the sequence at position SCALAR in NESTED-SEQUENCE

Construction evaluates and appends elements left to right. A failure publishes no constructed result.

Traversal, collection, and transformation ​

text
Collect SEQUENCE values in encounter order into a fresh sequence.
Retain every occurrence.

Retention can use a supported condition and may add Replace each retained value with SCALAR before appending it. Traversal uses increasing positions and binds the current occurrence once. Rejected values skip both update and transformation. Membership in the collected sequence observes the actual transformed prefix.

Aggregation and membership ​

Sum and Count traverse in encounter order with private zero state. Sum contributes the current value with checked addition; count contributes one. Empty input returns zero. Search and linear membership compare exact integers in increasing position order and stop their targeted search at the first match.

Boolean coordination and conditional computation ​

Supported Boolean lists are ordered uniform and or uniform inclusive or. Two items use a connector directly. Three or more items use comma forms with a final connector; retention grammar repeats it. and short-circuits on false and or on true. Skipped children do no runtime work, but whole-tree static validation still applies. Mixed connectors and arbitrary grouping are unavailable.

text
If COMPARISON [and|or COMPARISON]..., COMPUTATION Otherwise, COMPUTATION

Exactly one branch executes, both are statically checked, and result types must match. Direct conditional nesting is unsupported. The parser currently has a known malformed-comma defect; author only documented forms.

Accumulation and repetition ​

Sequential accumulation supports bounded scalar and pair frames. Each transition sees the old state and current occurrence; a successful result replaces state atomically. Supported terminal behavior returns final state, a supported observation, or an authored prefix sequence.

State repetition requires exactly one supported control policy: a pre-update continuation guard or a supported post-update stop. Transition frames determine required external sequence and scalar parameters. The lower-bound release example is the authoritative pair-state composition; separate features do not imply arbitrary state/control combinations.

Worklists ​

The fixed worklist family supports FIFO or LIFO, optional admission-time linear discovery, result append, optional exact target stopping, one parameterized sequence expansion, and exhaustion. FIFO uses a head index; LIFO removes the tail. With admission, discovery is recorded before enqueue. A removed item is appended before its target test, and a match stops before adjacency expansion.

Graph adjacency is a read-only nested-sequence context input. LIFO establishes pending order only and is not recursive DFS.

Tabulation ​

Tabulation copies integer seeds into a fresh table, checks the requested length before each extension, invokes one compatible ordinary recurrence, and appends atomically. The completed table can be returned or observed through a supported scalar expression. Supported combinations are the maintained Fibonacci and nonadjacent examples; there is no generic recurrence protocol or arbitrary element type.

Stated compiles controlled English deterministically. It does not call an LLM at compile time.