Operator Reference
Almadar's standard library provides 213+ built-in operators organized into 9 modules. All operators are available as s-expressions in guards and effects.
Modules
| Module | Prefix | Operators | Description |
|---|---|---|---|
| Math | math/* | 16 | Numeric operations for calculations, rounding, clamping, and randomization |
| String | str/* | 26 | Text manipulation including formatting, splitting, trimming, and templating |
| Array | array/* | 39 | Work with lists and arrays including filtering, mapping, and aggregation |
| Object | object/* | 18 | Access and manipulate object properties safely |
| Time | time/* | 25 | Work with dates, times, durations, and timestamps |
| Validate | validate/* | 23 | Validate user input with common patterns like email, required, length checks |
| Format | format/* | 9 | Display formatting for currency, numbers, dates, and file sizes |
| Async | async/* | 8 | Control timing with delays, debouncing, retries, and timeouts |
| Prob | prob/* | 16 | Distribution sampling, Bayesian inference, statistical summaries |
Quick Reference: Core Operators
These operators work without a module prefix:
| Operator | Example | Returns |
|---|---|---|
| Arithmetic | ["+", 1, 2] | number |
| Comparison | [">", "@entity.x", 5] | boolean |
| Logic | ["and", true, false] | boolean |
if | ["if", cond, then, else] | any |
do | ["do", expr1, expr2] | last value |
set | ["set", "@entity.x", 42] | void |
get | ["get", "@entity.x"] | any |
emit | ["emit", "EVENT"] | void |
See Core Concepts: Standard Library for the complete core operator list.