Ordo Expression Syntax
by Pama-Lee
Ordo expression syntax quick reference. Includes comparison operators, logical operators, built-in functions, conditional expressions, field access syntax. Use for writing rule conditions, calculating output values, data transformation.
Skill Details
Repository Files
1 file in this skill directory
name: ordo-expression-syntax description: Ordo expression syntax quick reference. Includes comparison operators, logical operators, built-in functions, conditional expressions, field access syntax. Use for writing rule conditions, calculating output values, data transformation.
Ordo Expression Syntax
Operators
Comparison Operators
| Operator | Description | Example |
|---|---|---|
== |
Equal | status == "active" |
!= |
Not equal | status != "banned" |
> |
Greater than | age > 18 |
>= |
Greater or equal | balance >= 1000 |
< |
Less than | price < 100 |
<= |
Less or equal | level <= 5 |
Logical Operators
| Operator | Description | Example |
|---|---|---|
&& |
And | age >= 18 && active == true |
|| |
Or | vip == true || points > 1000 |
! |
Not | !is_blocked |
Arithmetic Operators
| Operator | Description | Example |
|---|---|---|
+ |
Addition | price + tax |
- |
Subtraction | total - discount |
* |
Multiplication | quantity * price |
/ |
Division | total / count |
% |
Modulo | index % 2 |
Field Access
Dot Notation
user.name
user.profile.level
order.items[0].price
Array Indexing
items[0]
matrix[1][2]
users[index]
Safe Access (coalesce)
coalesce(user.nickname, user.name, "Anonymous")
Built-in Functions
String Functions
| Function | Description | Example |
|---|---|---|
len(s) |
String length | len(name) > 0 |
upper(s) |
To uppercase | upper(code) == "VIP" |
lower(s) |
To lowercase | lower(email) |
trim(s) |
Trim whitespace | trim(input) |
starts_with(s, prefix) |
Prefix match | starts_with(url, "https") |
ends_with(s, suffix) |
Suffix match | ends_with(file, ".pdf") |
contains_str(s, sub) |
Contains substring | contains_str(desc, "urgent") |
substring(s, start, end) |
Extract substring | substring(code, 0, 3) |
Math Functions
| Function | Description | Example |
|---|---|---|
abs(n) |
Absolute value | abs(diff) < 0.01 |
min(a, b, ...) |
Minimum | min(price, max_price) |
max(a, b, ...) |
Maximum | max(0, balance) |
floor(n) |
Floor | floor(rating) |
ceil(n) |
Ceiling | ceil(price) |
round(n) |
Round | round(average) |
Array Functions
| Function | Description | Example |
|---|---|---|
len(arr) |
Array length | len(items) > 0 |
sum(arr) |
Sum of array | sum(prices) >= 100 |
avg(arr) |
Average | avg(scores) > 60 |
count(arr) |
Element count | count(orders) |
first(arr) |
First element | first(results) |
last(arr) |
Last element | last(history) |
Type Functions
| Function | Description | Example |
|---|---|---|
type(v) |
Get type | type(value) == "string" |
is_null(v) |
Is null | is_null(optional) |
is_number(v) |
Is number | is_number(input) |
is_string(v) |
Is string | is_string(data) |
is_array(v) |
Is array | is_array(items) |
Conversion Functions
| Function | Description | Example |
|---|---|---|
to_int(v) |
To integer | to_int(str_num) |
to_float(v) |
To float | to_float(price) |
to_string(v) |
To string | to_string(code) |
Time Functions
| Function | Description | Example |
|---|---|---|
now() |
Current timestamp (seconds) | now() - created_at > 86400 |
now_millis() |
Current timestamp (milliseconds) | now_millis() |
Conditional Expressions
if-then-else
if condition then value1 else value2
Examples:
if exists(discount) then price * (1 - discount) else price
if vip == true then 0.2 else 0.05
if age >= 18 then "adult" else "minor"
exists Check
if exists(user.nickname) then user.nickname else user.name
Nested Conditions
if tier == "gold" then 0.2
else if tier == "silver" then 0.1
else 0.05
Literals
Numbers
42 # Integer
3.14 # Float
-100 # Negative
Strings
"hello"
"it's ok"
"line1\nline2"
Booleans
true
false
Null
null
Rust API
Parsing Expressions
use ordo_core::prelude::*;
let parser = ExprParser::new();
let expr = parser.parse("age >= 18 && status == \"active\"")?;
Evaluation
let evaluator = Evaluator::new();
let context = Context::from_json(r#"{"age": 25, "status": "active"}"#)?;
let result = evaluator.eval(&expr, &context)?;
Compile to Bytecode
let compiler = ExprCompiler::new();
let compiled = compiler.compile(&expr)?;
let vm = BytecodeVM::new();
let result = vm.execute(&compiled, &context)?;
Key Files
crates/ordo-core/src/expr/parser.rs- Expression parsercrates/ordo-core/src/expr/eval.rs- Expression evaluationcrates/ordo-core/src/expr/functions.rs- Built-in functionscrates/ordo-core/src/expr/ast.rs- AST definitions
Related Skills
Xlsx
Comprehensive spreadsheet creation, editing, and analysis with support for formulas, formatting, data analysis, and visualization. When Claude needs to work with spreadsheets (.xlsx, .xlsm, .csv, .tsv, etc) for: (1) Creating new spreadsheets with formulas and formatting, (2) Reading or analyzing data, (3) Modify existing spreadsheets while preserving formulas, (4) Data analysis and visualization in spreadsheets, or (5) Recalculating formulas
Clickhouse Io
ClickHouse database patterns, query optimization, analytics, and data engineering best practices for high-performance analytical workloads.
Clickhouse Io
ClickHouse database patterns, query optimization, analytics, and data engineering best practices for high-performance analytical workloads.
Analyzing Financial Statements
This skill calculates key financial ratios and metrics from financial statement data for investment analysis
Data Storytelling
Transform data into compelling narratives using visualization, context, and persuasive structure. Use when presenting analytics to stakeholders, creating data reports, or building executive presentations.
Kpi Dashboard Design
Design effective KPI dashboards with metrics selection, visualization best practices, and real-time monitoring patterns. Use when building business dashboards, selecting metrics, or designing data visualization layouts.
Dbt Transformation Patterns
Master dbt (data build tool) for analytics engineering with model organization, testing, documentation, and incremental strategies. Use when building data transformations, creating data models, or implementing analytics engineering best practices.
Sql Optimization Patterns
Master SQL query optimization, indexing strategies, and EXPLAIN analysis to dramatically improve database performance and eliminate slow queries. Use when debugging slow queries, designing database schemas, or optimizing application performance.
Anndata
This skill should be used when working with annotated data matrices in Python, particularly for single-cell genomics analysis, managing experimental measurements with metadata, or handling large-scale biological datasets. Use when tasks involve AnnData objects, h5ad files, single-cell RNA-seq data, or integration with scanpy/scverse tools.
Xlsx
Spreadsheet toolkit (.xlsx/.csv). Create/edit with formulas/formatting, analyze data, visualization, recalculate formulas, for spreadsheet processing and analysis.
