Browse documentation
Docs/Language

Language Feature Matrix

This page is the checklist for Grid's language surface.

Language Feature Matrix

This page is the checklist for Grid's language surface.

Most entries below are fully supported. Entries marked syntax-only are recognized for compatibility or diagnostics, but should not be used as working model features yet.

Status Key

  • supported: accepted by Grid and available to model authors.
  • syntax-only: syntax is recognized, but execution is not claimed.
  • diagnostic: negative syntax that exists to produce a precise error.

Source And Statements

  • **Multiple statements** (**supported**) - statements are separated by newlines or semicolons. Example: A1 = 1, then B1 = A1 + 1.
  • **Model directives** (**supported**) - metadata headers such as MODEL "Portfolio", DESCRIPTION "...", VERSION "1.0.0", AUTHOR "...", and TAGS "audit".
  • **Module imports** (**supported**) - USE "shared/finance.gs" AS finance imports reusable definitions under a namespace; EXPOSING (...) selects flat imports. Definitions-only .gs libraries may import transitively, while cycles, duplicate aliases, and executable library statements fail with diagnostics.
  • **Decision-package declarations** (supported) - DECISION PACKAGE pins a native computation's version, domain, dialects, capabilities, and typed artifact contracts in module metadata. Resident loading matches the complete declaration against the native registry and fails closed on unavailable or mismatched contracts.
  • **Capability requirements** (supported) - REQUIRES crm = NETWORK("https://api.example.com", GET) and REQUIRES auth = SECRET("crm.read") declare exact authority metadata for NETWORK.GET_JSON. Requirement aliases never become ordinary values or captured secrets; compiler-owned call contracts retain the normalized origin, method, secret purpose, and effect route.
  • **Assignment operators** (supported) - =, ~=, and ?= are production-lowered at top level; +=, -=, *=, and /= are production-lowered in rule actions and their documented typed mutation contexts.
  • **Conditional assignment** (supported) - A1 ?= MAYBE_FAIL() preserves the previous value if the RHS returns an error.
  • **Compound assignment** (**supported**) - rule actions perform native read-modify-write updates. Top-level arithmetic compound assignment is rejected because a declarative binding has no prior-value source; typed mutation contexts retain their own operator contracts.
  • **Typed assignments** (**supported**) - A1 IS currency = 125000 or currency A1 = 125000.
  • **Tensor and accelerator declarations** (supported) - shaped declarations such as A1 IS Tensor[2, 2] with precision 32 = SQUARE(values) lower to resident Tensor graphs when the optional accelerator is present and retain the same typed Workbook result when it is absent. Bounded ITERATE, PARAMETER, and TRAIN_ADAMW provide portable inference and training syntax. See Tensor shape, precision, and training for axis conventions, bounds, and the non-training array fallback.
  • **Infix `INTO` cast** (**supported**) - amount INTO currency overlays a type tag on an expression value; lowers to TYPE_TAG(amount, "currency"). Same semantic overlay as declaration-level IS, but usable inside expressions.
  • **Type-tag hierarchy** (**supported**) - tags refine one another (USD is a currency is a number; json is an object), a leaf implies its ancestors, and currencies take the currency:<code> qualifier (bare USD too) — unit: is for physical units.
  • **Strictness — `strict` / `loose`** (supported) - one header keyword sets both the dimensional and coercion axes; strict except <axis> differs on one. Under strict, a lossy arithmetic coercion or an incompatible type-tag is a #TYPE!, and the static analyses harden too: matrix-shape mismatches (GRID_MATRIX_SHAPE_MISMATCH) and refuted VALIDATE assertions (GRID_VALIDATE_UNSATISFIABLE) become compile errors.
  • **Dimensional checking directive** (supported) - dimensions strict, dimensions warn, and dimensions off select the dimensional-analysis policy independently of value coercion.
  • **Declared presentation — FORMAT / VALIDATE / ## notes** (supported) - trailing declarative clauses attach a format pattern, a validation clause, and doc notes to the cell in source. VALIDATE on an input cell is the write contract enforced at every write surface; on a computed cell it is a static assertion the compiler proves, refutes, or flags unverified via interval analysis. Top-level FORMAT <tag> <expr> declares tag policies; rule FORMAT actions and RESET FORMAT manage the override layer.
  • **Unary predicates** (**supported**) - predicate reviewed(by: string) declares a typed payload schema. x is :reviewed(reviewer) = 1 attaches it; the readability articles in x is a :reviewed(...) and x is an :reviewed(...) are optional. Declarations are single-valued by default; many by (id) permits several instances and defines their identity. In rules, += upserts one identity, keyed -= removes one, and bare -= removes all. Read single fields as scalars and many fields as arrays through PREDICATES(x).reviewed.by or x.predicates.reviewed.by. Field contracts fail closed; absent fields read as BLANK. Fieldless predicates such as :happy remain open and declaration-free. MODEL.PREDICATES.NEIGHBORS(:reviewed) performs a reactive reverse lookup through the unified Predicate graph; predicate vertices use colon-symbol identity, model symbols use canonical text identity, and many instances remain parallel :applies edges.
  • **General predicate programs** (supported) - predicate releasable means ... defines a proposition about its implicit subject. Facts, natural predicate laws, EXISTS/EVERY, named structural routes (THEN, OR, *, REVERSE), Boolean NO path, result-valued REACHABLE, checked therefore conclusions, and WHY share one Predicate engine. Recursive EVERY components use dependency-SCC-scoped greatest fixed points. General modality uses independent support/refutation evidence: EVIDENCE(atom) returns neither, supported, refuted, or both; MUST reads support, MAY means not refuted, and CANNOT reads refutation. The both state is paraconsistent and does not invalidate unrelated inference. Structured unary facts retain their declared payload and reactive state.
  • **Qualitative binary predicates** (supported) - temporal facts such as design before build and topology facts such as parcel inside district share bounded family-local inference with conceptual-set facts such as vip included in active. Topology is authored as separate from, touches, partially overlaps, coincides with, inside, encloses, and intersects, with optional with boundary contact / without boundary contact refinement. Conceptual sets use included in, includes, disjoint from, overlaps with, and same members as, with optional strictly refinement. Empty extents retain exact equality, inclusion, overlap, and disjointness meaning. Plain queries mean MUST; MAY, CANNOT, alternatives, complements, reactive IF/UNLESS, RELATION, RELATION_STATUS, WHY, family selection, and contradiction isolation are supported.
  • **`default` / `RESET` / `CLEAR`** (supported) - default B1 = … marks an overridable base a rule may set, RESET to the base, or CLEAR.
  • **`STATE` declarations** (**supported**) - STATE counter = 0 declares model-owned mutable state with an initial/reset base and sticky rule-written revisions.
  • **Input/output decorators** (supported) - input price = 0, output total = price * qty.
  • **Target references** (**supported**) - ordinary target cells such as D5 = 1.
  • **Surface namespace slots** (supported) - component slots such as Name!type, Name!config, Name!data, and Name!source are qualified named wires that can be assigned and referenced without requiring grid coordinates.
  • **Range target expansion** (supported) - A1:A5 = 0 expands to per-cell assignments.
  • **Destructuring assignment** (supported) - [total, avg, ...rest] = SUMMARY(B1:B10).
  • **Schedule modifiers** (**supported**) - A1 = NOW() ONCE, A1 = NOW() EVERY 5min, and A1 = TRUE AT dt"...".
  • **Rule blocks** (**supported**) - touch and predicate WHEN, settled-value CHANGES / BECOMES, and scheduled EVERY / AT blocks with eager rule-action assignments. WHEN supports SERIAL/bounded CONCURRENT admission and LATEST, bounded QUEUE, or durable LEDGER event retention using captured event-time inputs.
  • **Simulated-time authoring** (supported) - STOCK, PREV, and DELAY declare model-time state while SIM_TIME() and SIM_STEP() expose the active simulation clock. Simulation resolves use explicit or persisted t0/dt/step configuration and isolated scenario inputs; Euler is the default integrator, while RK4 is available for all-STOCK models and rejects discrete-state mixtures.
  • **`SOLVE` statements** (**supported**) - declarative goal-seek and bounded optimization over cells: SOLVE Z9 = A2 IN [0, 1] GOAL A3 = 200000, or MINIMIZE / MAXIMIZE an objective cell. The result cell receives the solved value; solves are reactive and never mutate the variable cell. See assignments.md.
  • **Block comments** (**supported**) - /* notes */, including multi-line comments.
  • **Diagnostics** (**supported**) - parser errors carry specific spans and recovery messages.
  • **Reserved words** (**diagnostic**) - Grid's grammar is contextual rather than lexically reserved. Structural and operator keywords such as WHEN, END, MODEL, WITH, and NOT are treated as grammar when that parse is available, so ambiguous uses produce a diagnostic instead of silently becoming a binding reference. Contextual words may remain valid names where no structural parse applies; authors should avoid all names listed in the reference.
  • **First-class grammars and parsers** (supported) - GRAMMAR name IS CFG|PEG|REGULAR ... END creates an immutable grammar value. grammar USING LALR|EARLEY|PACKRAT|DFA|AUTO creates a portable parser recipe, GENERATOR ... makes the strategy independently authorable, and PARSE(text, parser) returns a native parse-result value. Formalisms retain distinct choice semantics; recipes persist without process-local parser tables. graph syntax = GRAPH(parse_tree) publishes a successful tree through the ordinary resident Graph and Predicate reasoning stack with ordered child edges and source-span provenance. The grammar-bound tree substrate is available through its complete declaration surface — PATTERN, THEORY, ALGEBRA, TRANSFORM, TRANSLATE, SOLVER, and THEOREM — including bounded solver search, saturation, and checked theorems as proved equation sources. See grammars.md.
  • **Grid-native symbolic mathematics** (supported) - contextual symbol x declarations create immutable mathematical variables that compose through ordinary Grid operators, references, and admitted functions. The SYMBOLIC.* family provides exact rational construction, canonicalization, simplification, expansion, collection, factorization, rational transforms, typed substitution, exact evaluation, explicit arbitrary-precision approximation, assumptions, four-state decisions, differentiation, and complete admitted univariate solving. Results retain conditions, bounded work, completeness, and replayable Tree certificates; there is no held-body syntax, string evaluator, or alternate public AST. See symbolic-mathematics.md.
  • **Parser hardening edge cases** (supported) - regression coverage for ambiguous token boundaries.
  • **Multi-line bracket continuation** (supported) - calls, arrays, objects, and bracketed expressions may span lines while delimiters are open.
  • **Style-guide multi-line patterns** (supported) - canonical formatting for MATCH, objects, comprehensions, DO, and CASE.
  • **Trailing commas** (**supported**) - allowed in function calls, array literals, object literals, and MATCH arms.

Native Graph Algebra

  • **Resident graph bindings** (supported) - graph roads = GRAPH(...) creates a typed, immutable, revisioned property-graph handle that cannot spill into Workbook cells.
  • **Model graph relationships** (supported) - symbols and cells are implicit MODEL.GRAPH nodes; relates to adds directed edges and connects to adds bidirectional logical relationships, with typed payloads, list expansion, and stable identity.
  • **Unary-predicate compatibility view** (supported) - MODEL.TAGS retains the unary-only :<predicate> -> "model symbol" projection for source compatibility.
  • **Unified predicate graph view** (supported) - MODEL.PREDICATES combines live unary membership with authored binary facts and their temporal/topology/set family, descriptive relation set, and condition metadata without materializing inference closure into graph topology. Structured unary payloads are edge properties, and rule mutations participate in revisioned caching.
  • **Generic knowledge-graph reasoning** (supported) - KNOWLEDGE GRAPH knowledge VIA edge.relation projects an arbitrary resident GraphHandle into Predicate v10 with exact string, symbol, and integer node identity. WITH PROPERTIES adds joinable graph_node, graph_edge, graph_node_property, and graph_edge_property facts for typed scalar properties. WHY retains the exact graph, revision, node, edge, and property origins used by a proof, while inferred closure remains a separate derived view.
  • **Durable graph patch journal** (supported) - every accepted resident patch appends a revisioned event; append/replay/read APIs support optimistic graph and journal revision guards so persistence can replay the exact stream beside the same compiled model.
  • **Declarative paths** (supported) - path route = path in roads from a to b minimize hops states an objective; the planner selects and explains the physical kernel.
  • **First-class partitions** (supported) - connectivity, core/k-core, and deterministic Leiden/Louvain community contracts share a revision-bound partition value.
  • **Closed graph schemas and kinds** (supported) - graph schemas type node/edge properties, named node and edge kinds, and endpoint constraints; hydration and atomic patch staging revalidate the same closed contract.
  • **Graph views and immutable rewrites** (supported) - bounded comprehensions can fuse into a consumer or materialize a derived handle, while bounded edge-deletion rewrites publish one validated immutable revision.
  • **Graph projections and contraction** (supported) - path and partition handles expose typed scalar/Frame projections, and a revision-matched partition contracts into a deterministic quotient graph.
  • **Bounded graph patterns** (supported) - frame hits = match roads limit 100: ... return ... provides typed node/edge predicates and Frame projections with a mandatory result bound.
  • **Bounded graph fixed points** (supported) - frame values = fixpoint in roads: ... within 100 iterations exposes sum-product, min-plus, max-min, and boolean-or propagation with explicit direction, seeds, convergence, and work bounds.
  • **Graph `EXPLAIN`** (**supported**) - the read-only explainGraph(modelId) host method reports semantic contracts, physical plans, declared/effective budgets, transient/retained/peak memory, materialization, lineage, and resident state. See Graph Authoring.
  • **Typed graph domain bridges** (supported) - the production host projects the current resident graph revision into Geo routing, Network Flow, and Sim validators/kernels without an untyped intermediate representation.

Games And Mechanisms

  • **Declarative game blocks** (supported) - game Name { players = P; strategies = S; payoffs = U } validates live normal-form relations through GAME.NORMAL_FORM; the extensive = Tree form validates a perfect-information tree. Both lower to ordinary named call assignments and the canonical compiled call form.
  • **Finite strategic verification** (supported) - exhaustive pure Nash, regret, dominance, Pareto, welfare, and evidence-carrying GAME.VERIFY claims fail closed on incomplete domains or exhausted work.
  • **Certified equilibria** (supported) - independent zero-sum primal/dual LPs, bounded general bimatrix support enumeration, correlated-equilibrium incentive LPs, and perfect-information backward induction all replay their defining inequalities before publishing a result.
  • **Declarative direct mechanisms** (supported) - mechanism Name { direct = Specification } lowers through MECHANISM.DIRECT; exhaustive DSIC/BIC, ex-post/interim IR, no-deficit, and strong-budget-balance checks return concrete counterexamples.
  • **Allocation and auction mechanisms** (supported) - exact unit-demand welfare matching with VCG counterfactual payments plus deterministic first/second-price auctions with reserve and tie evidence. See game-theory.md.

Literals And Values

  • **Number literals** (**supported**) - integers, decimals, leading-dot decimals, and scientific notation.
  • **Numeric separators** (**supported**) - 1_000_000 and 0.000_001.
  • **Hex and binary literals** (supported) - 0xFF, 0b1010.
  • **Octal literals** (**supported**) - 0o755.
  • **String literals** (**supported**) - double-quoted, triple-quoted, raw, raw-triple, and backtick strings.
  • **String escapes** (**supported**) - newline, tab, quote escaping, and doubled quotes where documented.
  • **String interpolation** (**supported**)
    • `total={A1}`.
  • **Format specifiers in interpolation** (supported) - `total: {A1:"$#,##0.00"}`.
  • **Boolean literals** (**supported**) - TRUE and FALSE, case-insensitive.
  • **Wildcard and blank literals** (supported) - glob"*.csv", wild"inv-????", and BLANK.
  • **Typed literals** (**supported**) - date"...", dt"...", duration"...", cron"...", and domain literals such as url"...", mol"...", dna"...", color"...", note"...", bin"...", b64"...", and markup typed strings html"...", xhtml"...", svg"...", jsx"..."; any typed tag may also wrap the payload as <tag>...</tag>, for example <dna>ATCG</dna>.
  • **Exact numeric literals** (supported) - bigint"123456789012345678901234567890" for arbitrary-precision integers and decimal"0.1" for exact fixed-precision decimals, plus the BIGINT(...) constructor. Exact values keep their precision through arithmetic and number-theory functions such as ISPRIME, MODPOW, GCD, ISQRT, and RANDPRIME; decimal"0.1" + decimal"0.2" equals decimal"0.3" exactly. Mixing an exact value with a non-integer ordinary number is a #VALUE! instead of a silent floating-point rounding.
  • **Custom unit literals** (**supported**)
    • duration suffixes (5min), basis points (25bps), percentages (5pct), angles (45deg), data sizes (512MB), and 3-letter units (100USD).
  • **Custom unit declarations** (supported) - unit smoot = 1.7018 m and derived scale-only units extend dimensional inference without shadowing built-ins or using affine bases. Declarations and inferred dimensions persist in compiled module metadata.
  • **Model-owned FX-rate declarations** (supported) - fx_rate R1C2 = EUR/USD marks an ordinary numeric rate cell as a directional currency conversion. Dimensional checking accepts the declared direction, rejects the reverse use, and retains the declaration in compiled module metadata.
  • **Error literals** (**supported**) - #N/A, #DIV/0!, #VALUE!, #REF!, #NAME?, #NULL!, #NUM!, #CALC!, and #SPILL!.
  • **Regex literals** (**supported**) - /^INV-\d+$/i.
  • **Array literals** (**supported**) - [1, 2, 3], [1; 2; 3], and [1, 2; 3, 4].
  • **Spread in arrays** (**supported**) - [0, ...A1:A3, 4] desugars to HSTACK for horizontal concatenation.
  • **Object literals** (**supported**) - {name: "Ada", level: 9} and {"first name": "Ada"}.
  • **Parenthesized expressions** (supported) - (1 + 2) * 3.

References, Ranges, And Access

  • **Cell references** (**supported**) - `A1`, $A$1, AA100, R1C1, and R[1]C[-2].
  • **Named address aliases** (supported) - Revenue = A1 gives the existing reactive binding a semantic address; calculated or decorated named assignments remain distinct bindings.
  • **Ranges** (**supported**) - `A1:B10` and R1C1:R3C3.
  • **Full column and row ranges** (supported) - A:A, A:C, 1:1, and 1:3 in expression positions.
  • **Spill references** (**supported**) - A1# refers to the full spilled rectangle anchored at A1.
  • **Implicit intersection `@`** (diagnostic) - @A:A was removed (it never reduced a range to a row/column value — UnaryOp::At was pure identity). A prefix @ on a reference now rejects with GRID_IMPLICIT_INTERSECTION_REMOVED; reference the cell directly. Prefix @ remains valid for temporal coordinates (@today), and postfix @ remains valid for temporal references (A1@-1) and structured projection (data@"amount", data@["id", "amount"]).
  • **Object dot/bracket access** (supported) - obj.field, obj["field"], and optional chains.
  • **Bracket and dot access** (supported) - unified array/object access through INDEX.
  • **From-end indexing** (**supported**) - data[-1] and data[^1].
  • **Slice notation** (**supported**) - data[2:5], data[:3], data[3:], and data[1:10:2].
  • **Structured references** (supported) - Sales[Revenue].
  • **QUERY function** (**supported**) - QUERY(data, "SELECT * WHERE col1 > 5") for table-like arrays.
  • **Model table declarations** (supported) - table Orders = { schema: "orders" } declares durable table state, while table PaidOrders = SELECT ... FROM Orders declares a continuously maintained live table. Connector-backed table declarations retain their authored schema and ingestion contract as model metadata.
  • **Native `SELECT … FROM` expression** (supported) - SELECT id AS order_id, amount * 1.2 AS gross FROM Orders WHERE status IN ("paid", "pending") OR amount BETWEEN 10 AND 30 ORDER BY amount DESC LIMIT 25, plus grouped forms such as SELECT status, SUM(amount) AS total, COUNT(DISTINCT customer) AS customers FROM Orders GROUP BY status, parse and lower to structured relational IR (REL_SELECT(source, projection, predicate, order, limit, group, having)) instead of a SQL string. Header arrays and Tuple/Vector/Deque collections of Record rows execute natively, preserving the source sequence family. Connector- produced Frames also route through native filtering, ordering, limiting, and projection and may feed another query without materializing back to cells. Warehouse-backed queries push supported clauses to BigQuery, Snowflake, Redshift, and Databricks using provider-native parameter binding, with relational residuals executed in DataFusion. WHERE uses a canonical recursive predicate tree with SQL NOT/AND/OR precedence and three-valued blank/NULL behavior. LIKE/ILIKE use SQL % and _ wildcards. Computed projections use a typed scalar tree and require AS; arithmetic, searched and simple CASE, COALESCE, NULLIF, ABS, SQRT, FLOOR, CEIL/CEILING, ROUND, POWER, LOWER, UPPER, LENGTH, CAST, TRY_CAST, IN, and inclusive BETWEEN share the same backend-neutral contract. Cast targets canonicalize to number, string, or boolean; CAST reports an invalid conversion while TRY_CAST returns null. CASE is ordered, first-true, and treats unknown conditions as fallthrough. FETCH FIRST|NEXT n ROW|ROWS ONLY is the SQL-standard spelling of the same bounded result stage as LIMIT n. LIMIT n OFFSET m and OFFSET m [ROW|ROWS] [FETCH FIRST|NEXT n ROW|ROWS ONLY] share one result- window contract across resident values, Frames, Polars, DataFusion, and bounded warehouse pushdown. ORDER BY ... NULLS FIRST|LAST controls blank/ null placement for outer and analytic-window ordering; omitted placement remains null-last in both directions. Outer ORDER BY accepts typed scalar expressions and resolves both simple and computed SELECT aliases across resident collections, Frames, Polars, DataFusion, and warehouse pushdown; sort keys are evaluated once per row. Analytic-window ordering accepts the same scalar expressions; ranking, peers, and RANGE bounds share cached key values across those backends. COUNT(*) plus COUNT, COUNT(DISTINCT ...), SUM, AVG, MIN, and MAX over portable scalar expressions execute for resident values, Frames, Polars, DataFusion, and supported warehouse pushdown. Post-aggregate HAVING uses the same predicate tree. SELECT DISTINCT deduplicates typed projected rows before outer ordering and limiting across resident relations and source-proven Frames. SQL UNION, INTERSECT, and EXCEPT, with optional ALL, compose complete query results positionally. Typed duplicate/null semantics, SQL multiset counts, INTERSECT precedence, left-arm column names, and final-result ordering/limits are shared by resident collections and source-proven Frames. Analytic projections support ROW_NUMBER, RANK, DENSE_RANK, NTILE, PERCENT_RANK, CUME_DIST, LAG, LEAD, FIRST_VALUE, LAST_VALUE, NTH_VALUE, and windowed COUNT/SUM/AVG/MIN/MAX with PARTITION BY and ORDER BY, shared by resident values, Frames, local analytics, and warehouse pushdown. LAG/LEAD accept bounded offsets and scalar defaults; aggregate and value windows accept validated explicit ROWS BETWEEN ... AND ... and RANGE BETWEEN ... AND ... frames. Grouped queries stage WHERE, aggregation, HAVING, windows, outer ordering/result-window, and final projection in SQL logical order. Parenthesized relation subqueries and non-recursive SQL WITH name AS (SELECT ...) SELECT ... CTEs compose resident relation values directly and source-proven chains fuse into one physical Frame region; single-source aliases resolve qualified references without changing the source schema. Equality-correlatable EXISTS, NOT EXISTS, correlated IN, and null-aware correlated NOT IN over explicitly aliased sources lower to composite-key hash semi/anti joins while retaining inner-local and trailing outer filters. Correlated scalar aggregate projections lower to grouped inner relations plus typed lookup joins, with SQL empty-group defaults and no per-outer-row subquery evaluation. Multiple aggregate projections compose for resident relations and source-proven Frames. WITH RECURSIVE executes as a bounded fixpoint group over header arrays and native record sequences, with column lists, multiple bindings, simultaneous mutual recursion, per-binding UNION/UNION ALL, and explicit 1,000-iteration and 2,000,000-aggregate-row limits. Source-proven groups additionally promote to native Frame recursion, including explicit column lists, multiple or mutually recursive bindings, set expressions, and recursive equi-joins against other resident Frames. Explicitly aliased INNER, LEFT, RIGHT, and FULL equi-joins lower to REL_JOIN, execute as bounded typed hash joins for resident values and Frames, and support composite keys.
  • **PostgreSQL table queries** (supported) - PG_TABLE("finance", "public", "orders") and related bounded Postgres helpers.
  • **Native frames** (supported) - READ_PARQUET("orders.parquet") |> WHERE("amount > 0") creates a frame value for filtering, projections, and columnar analytics.
  • **Spatial references** (**supported**) - ABOVE, BELOW, LEFT, RIGHT, and directional offset forms.
  • **NEIGHBORS reference** (**supported**) - NEIGHBORS and NEIGHBORS(N).
  • **Temporal references** (**supported**)
    • A1@-1, A1@dt"...", and temporal-coordinate shorthands such as A1@today, A1@monday, A1@january, A1@1776, A1@5000BCE, and A1@2026-12-31 read historical values from model history.
  • **Iteration context** (**supported**) - ROW_INDEX, COL_INDEX, IS_FIRST, IS_LAST, and CELL_COUNT inside range-target rule actions, resolved for each materialized target cell.
  • **Header selection** (**supported**) - data@"amount" for a single header/key.
  • **PICK/OMIT/RENAME sugar** (supported) - data@["id", "amount"], data@!["secret"], data PICK id, glob"*amount*", data OMIT secret, data RENAME "old" AS "new".

Operators

  • **Binary operators** (**supported**) - arithmetic, concatenation, comparison, and equality operators.
  • **Unary operators** (**supported**) - unary +, unary -, logical !, and NOT.
  • **Pipeline operator `|>`** (supported) - frame |> WHERE("x > 0") |> COLLECT() desugars to nested function calls, placing the left expression as the first argument. values |> FILTER(value => predicate [, if_empty]) is the elementwise special form and lowers to FILTER(values, MAP(values, value => predicate) [, if_empty]). Ordinary FILTER(values, include_mask [, if_empty]) is unchanged outside a pipe; the legacy FILTER(_, _ > 0) pipe spelling remains accepted but is not canonical. See collections.md.
  • **Infix apply `OF`** (**supported**) - function-first mirror of pipe: ABS() OF A1 ≡ A1 >> ABS(); ROUND(_, 2) OF ABS() OF A1 is right-associative and ≡ A1 >> ABS() >> ROUND(_, 2). The left operand must be a function call (ABS(), not bare ABS); the right operand must be a value (cell, literal, or expression without _ placeholders). Callable OF callable is rejected. %OF is unrelated (percent-of → PERCENTOF); IS MULTIPLE OF stays on the comparison layer. See infix-operators.md.
  • **Percentage operator** (**supported**) - 50% is 0.5.
  • **Right-associative exponentiation** (supported) - 2 ^ 3 ^ 2 parses as 2 ^ (3 ^ 2).
  • **Exponent `**`** (**supported**) - 2 ** 3.
  • **Integer division** (**supported**) - 7 // 2 (floor division). Use QUOTIENT(n, d) for truncate-toward-zero division (Excel semantics). Backslash \ is not a division operator.
  • **Modulo operator** (**supported**) - 10 %% 3, 10 MOD 3, or 10 MODULO 3 (all desugar to MOD).
  • **Divides operator** (**supported**) - 10 DIVIDES 5, 10 NOT DIVIDES 3, or 10 /? 5 (desugar to MOD(a, b) = 0). See infix-operators.md.
  • **Coprime operator** (**supported**) - 8 COPRIME 15 (desugar to GCD(a, b) = 1).
  • **Bitwise infix operators** (supported) - a BITAND b, BITOR, BITXOR, BITLSHIFT/SHL, and BITRSHIFT/SHR.
  • **Array append** (**supported**) - [1, 2] ++ [3, 4] desugars to VSTACK.
  • **Collection operators** (**supported**) - [1, 2, 3] HAS 2, [1, 2] SUBSET OF [1, 2, 3], [1, 2, 3] SUPERSET OF [1, 2], and [1, 2] OVERLAPS [2, 3]. Membership and set relations compare direct elements without recursively flattening nested arrays; 2-D arrays expose rows, while subset/superset are unordered and duplicate-insensitive. Equality is type/tag-sensitive, compares errors by code, equates signed zero, never equates NaN, and distinguishes infinity signs.
  • **Factorial operators** (**supported**) - 5! and 7!!.
  • **String multiplication** (supported) - "ha" * 3 repeats text.
  • **Logical operators** (**supported**) - AND, OR, XOR, NOT, &&, and ||.
  • **Null coalescing** (**supported**) - A1 ?? 0; DEFAULT is the canonical spelling.
  • **Membership operators** (**supported**)
    • value IN [1, 2, 3] and value NOT IN set.
  • **Inequality aliases** (**supported**) - both <> and !=.
  • **BETWEEN operator** (**supported**) - 5 BETWEEN 1 AND 10, plus NOT BETWEEN.
  • **LIKE operator** (**supported**) - "Jon" LIKE "J*n" and NOT LIKE.
  • **String and ordered-containment operators** (supported) - STARTS WITH, ENDS WITH, ILIKE, and their NOT forms; CONTAINS is case-sensitive contiguous containment for both text and ordered arrays/tuples/vectors/deques, with linear sequence matching.
  • **IS predicates** (**supported**) - value IS NUMBER, value IS NOT BLANK, value IS EMPTY, value IS ODD, value IS EVEN, value IS PRIME, value IS MULTIPLE OF 5, and domain predicates such as value IS URL.
  • **Chained comparisons** (**supported**) - 0 <= score <= 100.
  • **Spaceship operator** (**supported**) - A1 <=> B1 returns -1, 0, or 1.
  • **Set operators** (**supported**) - `UNION`, INTERSECT, EXCEPT.
  • **EXCLUDE operator** (**supported**) - synonym for EXCEPT.
  • **Reduction operators** (**supported**) - +/ A1:A10, */ A1:A10, and &/ A1:A10.
  • **Broadcast-dot syntax** (supported) - SIN.([1, 2, 3]) and ROUND.(values, 2).
  • **Domain operators** (**supported**) - 25 %OF 200 and 100 TO 200.
  • **Combinatoric operators** (supported) - n CHOOSE k → COMBIN(n, k); n PERMUTE k → PERMUT(n, k); n MULTICHOOSE k → COMBINA(n, k). Bind tighter than *, /, //, and %% (5 * 3 CHOOSE 2 is 5 * COMBIN(3, 2)). Infix CHOOSE is unrelated to the lookup function CHOOSE(index, ...).
  • **Uncertainty operator** (**supported**)
    • 100 +/- 5 and 100 +/- measurement_error.

Expressions And Control Flow

  • **Function calls** (**supported**) - SUM(A1:A3), dotted function names such as Z.TEST(...), and the full generated catalog in functions.md.
  • **Named arguments** (**supported**) - ROUND(3.14159 AS number, 2 AS digits).
  • **Conditional expression** (supported) - score > 0 THEN "positive" ELSE "non-positive".
  • **LET function** (**supported**) - LET(x, 2, x + 3).
  • **DO blocks** (**supported**) - multi-line local bindings ending in a result expression. Async calls are dependency-aware: independent bindings launch concurrently, AWAIT adds a barrier, DO SYNC serializes async bindings, and the result waits for all active stages.
  • **Bounded effect traversal** (**supported**)
    • TRAVERSE applies one effectful named function serially and PAR_TRAVERSE applies it with an explicit concurrency bound. Both preserve source order, enforce collection and concurrency limits before launching work, and fail closed when the function has zero or multiple effect sites.
  • **WITH expression** (**supported**) - WITH data = HTTP_JSON(url), users = data.results THEN users[1] ELSE BLANK.
  • **WHERE clause** (**supported**) - total + tax WHERE total = SUM(A1:A10), tax = total * 0.21.
  • **USING...AS bindings** (**supported**) - total + tax USING total AS SUM(A1:A10), tax AS total * 0.21.
  • **UNLESS modifier** (**supported**) - amount UNLESS amount = 0.
  • **ASSERT guard** (**supported**) - value ASSERT value > 0 ELSE #N/A.
  • **TRY...THEN...ELSE error recovery** (supported) - TRY primary() THEN backup() ELSE "n/a".
  • **CASE WHEN expression** (**supported**)
    • CASE WHEN score >= 90 THEN "A" ELSE "F" END.
  • **Pattern matching** (**supported**) - MATCH(status, "draft" -> :gray, _ -> :red). Error-literal arms match on the subject's error kind without propagating — MATCH(risky, #DIV/0! -> 0, #N/A -> BLANK, _ -> risky).
  • **Choice sets** (**supported**) - CHOICE status = :green | :amber | :red declares a one-of enum that makes MATCH check exhaustiveness; CHOICES perms = :read | :write | :exec declares a flag set, where perms HAS :read + :write tests membership.
  • **Algebraic choices** (**supported**) - CHOICE Reply = Ok(value: number) | Rejected(reason: string) declares payload-bearing constructors such as Reply.Ok(7). Constructor-pattern MATCH is exhaustive, fields may recursively reference the enclosing type, and nested values are bounded to 64 levels.
  • **Arrow lambda** (**supported**) - x => x * 2, (acc, x) => acc + x.
  • **Named trailing blocks** (**supported**)
    • MAP(rows) WITH row DO ... END and REDUCE(0, values) WITH total, value DO ... END lower to the helpers' existing final lambda argument. Also supported by SCAN, ITERATE, BYROW, BYCOL, and MAKEARRAY, with checked parameter arity.
  • **LAMBDA function** (**supported**) - LAMBDA(x, x + 1).
  • **Named definitions** (**supported**) - DEFINE hypot(a, b) = SQRT(a^2 + b^2) names a reusable, non-recursive helper; the DEFINE keyword is optional (hypot(a, b) = …) and DEF is an accepted synonym. Definitions receive independently inferred principal signatures with fresh per-call polymorphism, open record rows, shared collection protocol constraints, and inferred connector effect rows. One shared callable body supports direct forward calls and _ partial application in supported callback positions; recursion and storing callable values in cells remain unsupported. See named functions.
  • **Named-function reflection** (supported) - ARGS(fn), BODY(fn), and FUNCTION(fn) fold at compile time to ordinary Grid values. BODY exposes a normalized, versionable AST shape with exhaustive structural coverage of the expression tree.
  • **Named-function calculus** (supported) - D(fn, x[, step]) differentiates a named definition using exact autodiff when available and central differences otherwise; INTEGRAL(fn, start, end[, control]) adaptively integrates a one-parameter definition. DERIVATIVE and INTEGRATE are the long-form aliases.
  • **Named-function sampling** (supported) - SAMPLE(fn, coordinates) realizes explicit points; SAMPLE(fn, start, end[, count_or_tolerance]) produces fixed-resolution or adaptive x/y rows whose reactive bounds can be driven by a chart viewport. Multi-parameter families select a varying parameter and bind the others by name; SAMPLE_INFO reports resolution, tolerance, discontinuities, and safety-limit metadata.
  • **Partial application** (**supported**) - SUM(5, _) produces a lambda when used as a value.
  • **Array comprehensions** (**supported**)
    • [x * 2 FOR x IN A1:A10 IF x > 0].
  • **Sequence shorthand** (**supported**) - 1..10, 1..<10, 1..2..10, and date/duration ranges.
  • **Exclusive range `..<`** (**supported**) - 1..<10 excludes the upper bound.
  • **Pipe operator** (**supported**) - A1 >> ABS() >> ROUND(_, 2). >> and |> share the same insertion and functional-FILTER lowering rules.
  • **WITH … DO pipeline** (**supported**) - WITH A1 DO FILTER(value => value > 0) THEN SORT(_, -1) >> TAKE(5) — same desugar as >> on _; after DO, steps may be separated by THEN, >>, or |>. Optional ELSE wraps the chain in IFERROR (classic WITH name = … THEN bindings are unchanged).
  • **TAP pipeline function** (supported) - value >> TAP passes the value through for inspection.
  • **Conditional pipeline** (supported) - value >> ABS() IF cond desugars to IF(cond, ABS(value), value). Each pipe step may have its own trailing IF; see infix-operators.md.

Function Catalog

The function catalog is the user-callable function reference:

  • functions.md lists every built-in function, grouped by category, with signature, return type, aliases, compatibility notes, and external contracts.
  • function-compatibility.md lists every canonical name and alias with its compatibility label.