Language Feature Matrix
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
- statements are separated by newlines or semicolons. Example:
A1 = 1, thenB1 = A1 + 1. - metadata headers such as
MODEL "Portfolio",DESCRIPTION "...",VERSION "1.0.0",AUTHOR "...", andTAGS "audit". - (supported) -
=,~=, and?=are production-lowered at top level;+=,-=,*=, and/=are production-lowered in rule actions and their documented typed mutation contexts. - (supported) -
A1 ?= MAYBE_FAIL()preserves the previous value if the RHS returns an error. - 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.
A1 IS currency = 125000orcurrency A1 = 125000.- 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. BoundedITERATE,PARAMETER, andTRAIN_ADAMWprovide portable inference and training syntax. amount INTO currencyoverlays a type tag on an expression value; lowers toTYPE_TAG(amount, "currency"). Same semantic overlay as declaration-levelIS, but usable inside expressions.- tags refine one another (
USDis acurrencyis anumber;jsonis anobject), a leaf implies its ancestors, and currencies take thecurrency:<code>qualifier (bareUSDtoo) —unit:is for physical units. - (supported) - one header keyword sets both the dimensional and coercion
axes;
strict except <axis>differs on one. Understrict, 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 refutedVALIDATEassertions (GRID_VALIDATE_UNSATISFIABLE) become compile errors. FORMAT/VALIDATE/##notes** (supported) - trailing declarative clauses attach a format pattern, a validation clause, and doc notes to the cell in source.VALIDATEon aninputcell 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-levelFORMAT <tag> <expr>declares tag policies; ruleFORMATactions andRESET FORMATmanage the override layer.predicate reviewed(by: string)declares a typed payload schema.x is :reviewed(reviewer) = 1attaches it; the readability articles inx is a :reviewed(...)andx 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 throughPREDICATES(x).reviewed.byorx.predicates.reviewed.by. Field contracts fail closed; absent fields read asBLANK. Fieldless predicates such as:happyremain 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, andmanyinstances remain parallel:appliesedges.- (supported) -
predicate releasable means ...defines a proposition about its implicit subject. Facts, natural predicate laws,EXISTS/EVERY, named structural routes (THEN,OR,*,REVERSE), BooleanNO path, result-valuedREACHABLE, checkedthereforeconclusions, andWHYshare one Predicate engine. RecursiveEVERYcomponents use dependency-SCC-scoped greatest fixed points. General modality uses independent support/refutation evidence:EVIDENCE(atom)returnsneither,supported,refuted, orboth;MUSTreads support,MAYmeans not refuted, andCANNOTreads refutation. Thebothstate is paraconsistent and does not invalidate unrelated inference. Structured unary facts retain their declared payload and reactive state. - (supported) - temporal facts such as
design before buildand topology facts such asparcel inside districtshare bounded family-local inference with conceptual-set facts such asvip included in active. Topology is authored asseparate from,touches,partially overlaps,coincides with,inside,encloses, andintersects, with optionalwith boundary contact/without boundary contactrefinement. Conceptual sets useincluded in,includes,disjoint from,overlaps with, andsame members as, with optionalstrictlyrefinement. Empty extents retain exact equality, inclusion, overlap, and disjointness meaning. Plain queries meanMUST;MAY,CANNOT, alternatives, complements, reactiveIF/UNLESS,RELATION,RELATION_STATUS,WHY, family selection, and contradiction isolation are supported. - (supported) -
default B1 = …marks an overridable base a rule mayset,RESETto the base, orCLEAR. STATE counter = 0declares model-owned mutable state with an initial/reset base and sticky rule-written revisions.- (supported) -
input price = 0,output total = price * qty. - ordinary target cells such as
D5 = 1. - (supported) -
A1:A5 = 0expands to per-cell assignments. - (supported) -
[total, avg, ...rest] = SUMMARY(B1:B10). A1 = NOW() ONCE,A1 = NOW() EVERY 5min, andA1 = TRUE AT dt"...".- predicate
WHEN, settled-valueCHANGES/BECOMES, and scheduledEVERY/ATblocks with eager rule-action assignments.WHENsupportsSERIAL/boundedCONCURRENTadmission andLATEST, boundedQUEUE, or durableLEDGERevent retention using captured event-time inputs. - declarative goal-seek and bounded optimization over cells:
SOLVE Z9 = A2 IN [0, 1] GOAL A3 = 200000, orMINIMIZE/MAXIMIZEan objective cell. The result cell receives the solved value; solves are reactive and never mutate the variable cell. Seeassignments.md. /* notes */, including multi-line comments.- carry specific spans and recovery messages.
- Grid's grammar is contextual rather than lexically reserved. Structural and
operator keywords such as
WHEN,END,MODEL,WITH, andNOTare 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. - (supported) -
GRAMMAR name IS CFG|PEG|REGULAR ... ENDcreates an immutable grammar value.grammar USING LALR|EARLEY|PACKRAT|DFA|AUTOcreates a portable parser recipe,GENERATOR ...makes the strategy independently authorable, andPARSE(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, andTHEOREM— including bounded solver search, saturation, and checked theorems as proved equation sources. Seegrammars.md. - (supported) - contextual
symbol xdeclarations create immutable mathematical variables that compose through ordinary Grid operators, references, and admitted functions. TheSYMBOLIC.*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. Seesymbolic-mathematics.md. - (supported) - regression coverage for ambiguous token boundaries.
- continuation** (supported) - calls, arrays, objects, and bracketed expressions may span lines while delimiters are open.
- patterns** (supported) - canonical formatting for
MATCH, objects, comprehensions,DO, andCASE. - allowed in function calls, array literals, object literals, and
MATCHarms.
Native Graph Algebra
- (supported) -
graph roads = GRAPH(...)creates a typed, immutable, revisioned property-graph handle that cannot spill into Workbook cells. - (supported) - symbols and cells are implicit
MODEL.GRAPHnodes;relates toadds directed edges andconnects toadds bidirectional logical relationships, with typed payloads, list expansion, and stable identity. - (supported) -
MODEL.TAGSretains the unary-only:<predicate> -> "model symbol"projection for source compatibility. - (supported) -
MODEL.PREDICATEScombines 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. - (supported) -
KNOWLEDGE GRAPH knowledge VIA edge.relationprojects an arbitrary resident GraphHandle into Predicate v10 with exact string, symbol, and integer node identity.WITH PROPERTIESadds joinablegraph_node,graph_edge,graph_node_property, andgraph_edge_propertyfacts for typed scalar properties.WHYretains the exact graph, revision, node, edge, and property origins used by a proof, while inferred closure remains a separate derived view. - (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.
- (supported) -
path route = path in roads from a to b minimize hopsstates an objective; the planner selects and explains the physical kernel. - (supported) - connectivity, core/k-core, and deterministic Leiden/Louvain community contracts share a revision-bound partition value.
- (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.
- (supported) - bounded comprehensions can fuse into a consumer or materialize a derived handle, while bounded edge-deletion rewrites publish one validated immutable revision.
- contraction** (supported) - path and partition handles expose typed scalar/Frame projections, and a revision-matched partition contracts into a deterministic quotient graph.
- (supported) -
frame hits = match roads limit 100: ... return ...provides typed node/edge predicates and Frame projections with a mandatory result bound. - (supported) -
frame values = fixpoint in roads: ... within 100 iterationsexposes sum-product, min-plus, max-min, and boolean-or propagation with explicit direction, seeds, convergence, and work bounds. - read-only
explainGraph(modelId)host method reports semantic contracts, physical plans, declared/effective budgets, transient/retained/peak memory, materialization, lineage, and resident state. Seegraphs.md. - (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
- (supported) -
game Name { players = P; strategies = S; payoffs = U }validates live normal-form relations throughGAME.NORMAL_FORM; theextensive = Treeform validates a perfect-information tree. Both lower to ordinary named call assignments and the canonical compiled call form. - (supported) - exhaustive pure Nash, regret, dominance, Pareto, welfare,
and evidence-carrying
GAME.VERIFYclaims fail closed on incomplete domains or exhausted work. - (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.
- (supported) -
mechanism Name { direct = Specification }lowers throughMECHANISM.DIRECT; exhaustive DSIC/BIC, ex-post/interim IR, no-deficit, and strong-budget-balance checks return concrete counterexamples. - (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
- integers, decimals, leading-dot decimals, and scientific notation.
1_000_000and0.000_001.- (supported) -
0xFF,0b1010. 0o755.- double-quoted, triple-quoted, raw, raw-triple, and backtick strings.
- newline, tab, quote escaping, and doubled quotes where documented.
-
`total={A1}`.
- interpolation** (supported) -
`total: {A1:"$#,##0.00"}`. TRUEandFALSE, case-insensitive.- (supported) -
glob"*.csv",wild"inv-????", andBLANK. date"...",dt"...",duration"...",cron"...", and domain literals such asurl"...",mol"...",dna"...",color"...",note"...",bin"...",b64"...", and markup typed stringshtml"...",xhtml"...",svg"...",jsx"..."; any typed tag may also wrap the payload as<tag>...</tag>, for example<dna>ATCG</dna>.- (supported) -
bigint"123456789012345678901234567890"for arbitrary-precision integers anddecimal"0.1"for exact fixed-precision decimals, plus theBIGINT(...)constructor. Exact values keep their precision through arithmetic and number-theory functions such asISPRIME,MODPOW,GCD,ISQRT, andRANDPRIME;decimal"0.1" + decimal"0.2"equalsdecimal"0.3"exactly. Mixing an exact value with a non-integer ordinary number is a#VALUE!instead of a silent floating-point rounding. -
- duration suffixes (
5min), basis points (25bps), percentages (5pct), angles (45deg), data sizes (512MB), and 3-letter units (100USD).
- duration suffixes (
#N/A,#DIV/0!,#VALUE!,#REF!,#NAME?,#NULL!,#NUM!,#CALC!, and#SPILL!./^INV-\d+$/i.[1, 2, 3],[1; 2; 3], and[1, 2; 3, 4].[0, ...A1:A3, 4]desugars toHSTACKfor horizontal concatenation.{name: "Ada", level: 9}and{"first name": "Ada"}.- (supported) -
(1 + 2) * 3.
References, Ranges, And Access
$A$1,AA100,R1C1, andR[1]C[-2].- (supported) -
Revenue = A1gives the existing reactive binding a semantic address; calculated or decorated named assignments remain distinct bindings. R1C1:R3C3.- (supported) -
A:A,A:C,1:1, and1:3in expression positions. A1#refers to the full spilled rectangle anchored atA1.- (diagnostic) -
@A:Awas removed (it never reduced a range to a row/column value —UnaryOp::Atwas pure identity). A prefix@on a reference now rejects withGRID_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"]). - (supported) -
obj.field,obj["field"], and optional chains. - (supported) - unified array/object access through
INDEX. data[-1]anddata[^1].data[2:5],data[:3],data[3:], anddata[1:10:2].- (supported) -
Sales[Revenue]. QUERY(data, "SELECT * WHERE col1 > 5")for table-like arrays.- (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 asSELECT 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 andTuple/Vector/Dequecollections ofRecordrows 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.WHEREuses a canonical recursive predicate tree with SQLNOT/AND/ORprecedence and three-valued blank/NULLbehavior.LIKE/ILIKEuse SQL%and_wildcards. Computed projections use a typed scalar tree and requireAS; arithmetic, searched and simpleCASE,COALESCE,NULLIF,ABS,SQRT,FLOOR,CEIL/CEILING,ROUND,POWER,LOWER,UPPER,LENGTH,CAST,TRY_CAST,IN, and inclusiveBETWEENshare the same backend-neutral contract. Cast targets canonicalize tonumber,string, orboolean;CASTreports an invalid conversion whileTRY_CASTreturns null.CASEis ordered, first-true, and treats unknown conditions as fallthrough.FETCH FIRST|NEXT n ROW|ROWS ONLYis the SQL-standard spelling of the same bounded result stage asLIMIT n.LIMIT n OFFSET mandOFFSET 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|LASTcontrols blank/ null placement for outer and analytic-window ordering; omitted placement remains null-last in both directions. OuterORDER BYaccepts 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, andRANGEbounds share cached key values across those backends.COUNT(*)plusCOUNT,COUNT(DISTINCT ...),SUM,AVG,MIN, andMAXover portable scalar expressions execute for resident values, Frames, Polars, DataFusion, and supported warehouse pushdown. Post-aggregateHAVINGuses the same predicate tree.SELECT DISTINCTdeduplicates typed projected rows before outer ordering and limiting across resident relations and source-proven Frames. SQLUNION,INTERSECT, andEXCEPT, with optionalALL, compose complete query results positionally. Typed duplicate/null semantics, SQL multiset counts,INTERSECTprecedence, left-arm column names, and final-result ordering/limits are shared by resident collections and source-proven Frames. Analytic projections supportROW_NUMBER,RANK,DENSE_RANK,NTILE,PERCENT_RANK,CUME_DIST,LAG,LEAD,FIRST_VALUE,LAST_VALUE,NTH_VALUE, and windowedCOUNT/SUM/AVG/MIN/MAXwithPARTITION BYandORDER BY, shared by resident values, Frames, local analytics, and warehouse pushdown.LAG/LEADaccept bounded offsets and scalar defaults; aggregate and value windows accept validated explicitROWS BETWEEN ... AND ...andRANGE BETWEEN ... AND ...frames. Grouped queries stageWHERE, aggregation,HAVING, windows, outer ordering/result-window, and final projection in SQL logical order. Parenthesized relation subqueries and non-recursive SQLWITH 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-correlatableEXISTS,NOT EXISTS, correlatedIN, and null-aware correlatedNOT INover 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 RECURSIVEexecutes as a bounded fixpoint group over header arrays and native record sequences, with column lists, multiple bindings, simultaneous mutual recursion, per-bindingUNION/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 aliasedINNER,LEFT,RIGHT, andFULLequi-joins lower toREL_JOIN, execute as bounded typed hash joins for resident values and Frames, and support composite keys. - (supported) -
PG_TABLE("finance", "public", "orders")and related bounded Postgres helpers. - (supported) -
READ_PARQUET("orders.parquet") |> WHERE("amount > 0")creates aframevalue for filtering, projections, and columnar analytics. ABOVE,BELOW,LEFT,RIGHT, and directional offset forms.NEIGHBORSandNEIGHBORS(N).-
A1@-1,A1@dt"...", and temporal-coordinate shorthands such asA1@today,A1@monday,A1@january,A1@1776,A1@5000BCE, andA1@2026-12-31read historical values from model history.
ROW_INDEX,COL_INDEX,IS_FIRST,IS_LAST, andCELL_COUNTinside range-target rule actions, resolved for each materialized target cell.data@"amount"for a single header/key.- (supported) -
data@["id", "amount"],data@!["secret"],data PICK id, glob"*amount*",data OMIT secret,data RENAME "old" AS "new".
Operators
- arithmetic, concatenation, comparison, and equality operators.
+, unary-, logical!, andNOT.- (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 toFILTER(values, MAP(values, value => predicate) [, if_empty]). OrdinaryFILTER(values, include_mask [, if_empty])is unchanged outside a pipe; the legacyFILTER(_, _ > 0)pipe spelling remains accepted but is not canonical. Seecollections.md. - function-first mirror of pipe:
ABS() OF A1≡A1 >> ABS();ROUND(_, 2) OF ABS() OF A1is right-associative and ≡A1 >> ABS() >> ROUND(_, 2). The left operand must be a function call (ABS(), not bareABS); the right operand must be a value (cell, literal, or expression without_placeholders). CallableOFcallable is rejected.%OFis unrelated (percent-of →PERCENTOF);IS MULTIPLE OFstays on the comparison layer. Seeinfix-operators.md. 50%is0.5.- exponentiation** (supported) -
2 ^ 3 ^ 2parses as2 ^ (3 ^ 2). 2 ** 3.7 // 2(floor division). UseQUOTIENT(n, d)for truncate-toward-zero division (Excel semantics). Backslash\is not a division operator.10 %% 3,10 MOD 3, or10 MODULO 3(all desugar toMOD).10 DIVIDES 5,10 NOT DIVIDES 3, or10 /? 5(desugar toMOD(a, b) = 0). Seeinfix-operators.md.8 COPRIME 15(desugar toGCD(a, b) = 1).- (supported) -
a BITAND b,BITOR,BITXOR,BITLSHIFT/SHL, andBITRSHIFT/SHR. [1, 2] ++ [3, 4]desugars toVSTACK.[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 equatesNaN, and distinguishes infinity signs.5!and7!!.- (supported) -
"ha" * 3repeats text. AND,OR,XOR,NOT,&&, and||.A1 ?? 0;DEFAULTis the canonical spelling.-
value IN [1, 2, 3]andvalue NOT IN set.
- both
<>and!=. 5 BETWEEN 1 AND 10, plusNOT BETWEEN."Jon" LIKE "J*n"andNOT LIKE.- operators** (supported) -
STARTS WITH,ENDS WITH,ILIKE, and theirNOTforms;CONTAINSis case-sensitive contiguous containment for both text and ordered arrays/tuples/vectors/deques, with linear sequence matching. 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 asvalue IS URL.0 <= score <= 100.A1 <=> B1returns-1,0, or1.INTERSECT,EXCEPT.- synonym for
EXCEPT. +/ A1:A10,*/ A1:A10, and&/ A1:A10.- (supported) -
SIN.([1, 2, 3])andROUND.(values, 2). 25 %OF 200and100 TO 200.- (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 2is5 * COMBIN(3, 2)). InfixCHOOSEis unrelated to the lookup functionCHOOSE(index, ...). -
100 +/- 5and100 +/- measurement_error.
Expressions And Control Flow
SUM(A1:A3), dotted function names such asZ.TEST(...), and the full generated catalog infunctions.md.ROUND(3.14159 AS number, 2 AS digits).- (supported) -
score > 0 THEN "positive" ELSE "non-positive". LET(x, 2, x + 3).- bindings ending in a result expression. Async calls are dependency-aware:
independent bindings launch concurrently,
AWAITadds a barrier,DO SYNCserializes async bindings, and the result waits for all active stages. -
TRAVERSEapplies one effectful named function serially andPAR_TRAVERSEapplies 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 data = HTTP_JSON(url), users = data.results THEN users[1] ELSE BLANK.total + tax WHERE total = SUM(A1:A10), tax = total * 0.21.total + tax USING total AS SUM(A1:A10), tax AS total * 0.21.amount UNLESS amount = 0.value ASSERT value > 0 ELSE #N/A.- recovery** (supported) -
TRY primary() THEN backup() ELSE "n/a". -
CASE WHEN score >= 90 THEN "A" ELSE "F" END.
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 status = :green | :amber | :reddeclares a one-of enum that makesMATCHcheck exhaustiveness;CHOICES perms = :read | :write | :execdeclares a flag set, whereperms HAS :read + :writetests membership.CHOICE Reply = Ok(value: number) | Rejected(reason: string)declares payload-bearing constructors such asReply.Ok(7). Constructor-patternMATCHis exhaustive, fields may recursively reference the enclosing type, and nested values are bounded to 64 levels.x => x * 2,(acc, x) => acc + x.-
MAP(rows) WITH row DO ... ENDandREDUCE(0, values) WITH total, value DO ... ENDlower to the helpers' existing final lambda argument. Also supported bySCAN,ITERATE,BYROW,BYCOL, andMAKEARRAY, with checked parameter arity.
LAMBDA(x, x + 1).DEFINE hypot(a, b) = SQRT(a^2 + b^2)names a reusable, non-recursive helper; theDEFINEkeyword is optional (hypot(a, b) = …) andDEFis 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; runtime lowering remains the compatibleLETexpansion.- (supported) -
ARGS(fn),BODY(fn), andFUNCTION(fn)fold at compile time to ordinary Grid values.BODYexposes a normalized, versionable AST shape with exhaustive structural coverage of the expression tree. - (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.DERIVATIVEandINTEGRATEare the long-form aliases. - (supported) -
SAMPLE(fn, coordinates)realizes explicit points;SAMPLE(fn, start, end[, count_or_tolerance])produces fixed-resolution or adaptivex/yrows whose reactive bounds can be driven by a chart viewport. Multi-parameter families select a varying parameter and bind the others by name;SAMPLE_INFOreports resolution, tolerance, discontinuities, and safety-limit metadata. SUM(5, _)produces a lambda when used as a value.-
[x * 2 FOR x IN A1:A10 IF x > 0].
1..10,1..<10,1..2..10, and date/duration ranges.1..<10excludes the upper bound.A1 >> ABS() >> ROUND(_, 2).>>and|>share the same insertion and functional-FILTER lowering rules.WITH A1 DO FILTER(value => value > 0) THEN SORT(_, -1) >> TAKE(5)— same desugar as>>on_; afterDO, steps may be separated byTHEN,>>, or|>. OptionalELSEwraps the chain inIFERROR(classicWITH name = … THENbindings are unchanged).- (supported) -
value >> TAPpasses the value through for inspection. - (supported) -
value >> ABS() IF conddesugars toIF(cond, ABS(value), value). Each pipe step may have its own trailingIF; seeinfix-operators.md.
Function Catalog
The function catalog is the user-callable function reference:
functions.mdlists every built-in function, grouped by category, with signature, return type, aliases, compatibility notes, and external contracts.function-compatibility.mdlists every canonical name and alias with its compatibility label.