Expressif is a language for describing data transformations, validations, computations, and aggregations as expressions.

If you already have some programming experience, the most useful mental model is simple:

flowchart LR
    A[Input value] --> B[Expression]
    B --> C[Result value]

An expression can be as small as a single function:

upper

or a pipeline of transformations:

@customer
| .orders
| filter(.active)
| map(.amount)
| sum

The value flows from left to right. Each step receives a value and produces another value.

A first expression

Consider:

10 | add(5)

The input value is 10. The function add(5) receives that value and returns 15.

flowchart LR
    A["10"] --> B["add(5)"]
    B --> C["15"]

The same idea scales to structured data:

@customer
| .orders
| filter(.active)
| map(.amount)
| sum
flowchart LR
    A["@customer"] --> B[".orders"]
    B --> C["filter(.active)"]
    C --> D["map(.amount)"]
    D --> E["sum"]

The important point is not the exact data type at every step. It is that every step has a well-defined input and output.

Start with Expressions to understand input values, the current object, pipelines, and nested expressions.

Then continue with:

  • Values and types for literals and the Expressif type system.
  • References for variables, constants, fields, tuple items, and the current object.
  • Functions for function calls, parameters, named arguments, and return values.
  • Structured values for arrays, tuples, records, mapping, filtering, and aggregation.
  • Predicates for expressions that answer yes/no questions.
  • Shorthands for shorter forms of common expressions.
  • Advanced expressions for parameterized expressions, array spread, incoming values, intervals, folds, and related constructs.
  • The Expressif philosophy for the design principles behind the language.

Read expressions as transformations

When reading Expressif, avoid thinking in terms of statements such as:

set x
loop
if
assign
return

Prefer to read:

input
→ transform
→ select
→ aggregate
→ result

That is the core of the language.


Table of contents


This site uses Just the Docs, a documentation theme for Jekyll.