SELSimple Expression Language
GitHub

Builtins

Every SEL builtin, from the authored manifest spec/builtins.json (format: spec/builtins.md). Arguments is the accepted count; Evaluates says whether the function receives values (strict) or argument nodes (lazy), and whether it introduces an element binder. The section is where spec/SPEC.md defines the semantics; this table only says what the function table knows.

Name Signature Arguments Evaluates Spec
ABORT ABORT(message) 1 strict §7.2
ABS ABS(x) 1 strict §7.6
ALL ALL(list, [binder,] body) 2–3 lazy, binds §7.3
ANY ANY(list, [binder,] body) 2–3 lazy, binds §7.3
BACKWARDS BACKWARDS(x) 1 strict §7.5
BLEN BLEN(x) 1 strict §7.7
BTL BTL(x) 1 strict §7.7
BUCKET BUCKET(list, [binder,] key)
BUCKET(list, [binder,] key, proj)
2–4 lazy, binds §7.3
CANON CANON(x) 1 strict §7.6
CEIL CEIL(x) 1 strict §7.6
CHAR CHAR(n) 1 strict §7.5
COALESCE COALESCE(a, b, …) 1+ lazy §7.9
CODE CODE(x) 1 strict §7.5
COND COND(c1, r1, …, default) 3+, odd lazy §7.2
COUNT COUNT(x) 1 strict §7.4
CRC32 CRC32(x) 1 strict §7.7
DECODE_BASE64 DECODE_BASE64(x) 1 strict §7.7
DEDUPE DEDUPE(list) 1 strict §7.4
DISTINCT DISTINCT(list) 1 strict §7.4
DROP DROP(list, n) 2 strict §7.4
ENCODE_BASE64 ENCODE_BASE64(x) 1 strict §7.7
FILTER FILTER(list, [binder,] body) 2–3 lazy, binds §7.3
FIND FIND(needle, hay [, from]) 2–3 strict §7.5
FLOOR FLOOR(x) 1 strict §7.6
FROM_HEX FROM_HEX(x) 1 strict §7.7
FROM_UTF8 FROM_UTF8(x) 1 strict §7.7
GET GET(target, key [, default]) 2–3 lazy §7.9
HAS HAS(x, key) 2 strict §7.4
IF IF(cond, then [, else]) 2–3 lazy §7.2
INDEXES INDEXES(x) 1 strict §7.4
ISNUM ISNUM(x) 1 strict §7.6
IS_BLANK IS_BLANK(x) 1 strict §7.9
IS_NOT_NULL IS_NOT_NULL(x) 1 strict §7.9
IS_NULL IS_NULL(x) 1 strict §7.9
IS_PRESENT IS_PRESENT(x) 1 strict §7.9
JOIN JOIN(list, sep) 2 strict §7.3
LEFT LEFT(x, n) 2 strict §7.5
LEN LEN(x) 1 strict §7.5
LINK LINK(left, right, pred)
LINK(left, right, L, R, pred)
3 or 5 lazy, binds §7.4
LINK_LEFT LINK_LEFT(left, right, pred)
LINK_LEFT(left, right, L, R, pred)
3 or 5 lazy, binds §7.4
LIST LIST(v1, v2, …) 0+ strict §7.4
LOWER LOWER(x) 1 strict §7.5
LTB LTB(list) 1 strict §7.7
LTRIM LTRIM(x) 1 strict §7.5
MAP MAP(list, [binder,] body) 2–3 lazy, binds §7.3
MAX MAX(a, b, …) 1+ strict §7.6
MIN MIN(a, b, …) 1+ strict §7.6
PADL PADL(x, n, fill) 3 strict §7.5
PADR PADR(x, n, fill) 3 strict §7.5
PATH PATH(target, path_str [, default]) 2–3 lazy §7.9
POWER POWER(x, n) 2 strict §7.6
RECORD RECORD(k1, v1, k2, v2, …) 0+, even strict §7.4
REPEAT REPEAT(x, n) 2 strict §7.5
REPLACE REPLACE(needle, repl, hay) 3 strict §7.5
RFIND RFIND(pat, subj [, flags]) 2–3 strict §7.8
RGROUPS RGROUPS(pat, subj [, flags]) 2–3 strict §7.8
RIGHT RIGHT(x, n) 2 strict §7.5
RMATCH RMATCH(pat, subj [, flags]) 2–3 strict §7.8
ROUND ROUND(x, n) 2 strict §7.6
RREPLACE RREPLACE(pat, repl, subj [, flags]) 3–4 strict §7.8
RTRIM RTRIM(x) 1 strict §7.5
SELECT_COLS SELECT_COLS(rel, c1, c2, …) 2+ strict §7.4
SIGN SIGN(x) 1 strict §7.6
SORT SORT(list, [binder,] [body]) 1–3 lazy, binds §7.3
SORT_BY SORT_BY(list, [binder,] key [, dir]) 2–4 lazy, binds §7.3
SORT_DESC SORT_DESC(list, [binder,] [body]) 1–3 lazy, binds §7.3
SPLIT SPLIT(x, sep) 2 strict §7.5
SUBSTR SUBSTR(x, start [, len]) 2–3 strict §7.5
SUM SUM(list, [binder,] body) 2–3 lazy, binds §7.3
TAKE TAKE(list, n) 2 strict §7.4
TOP TOP(list, [binder,] [body,] n) 2–4 lazy, binds §7.4
TOP_BY TOP_BY(list, [binder,] key, n [, dir]) 3–5 lazy, binds §7.4
TOP_DESC TOP_DESC(list, [binder,] [body,] n) 2–4 lazy, binds §7.4
TO_HEX TO_HEX(x) 1 strict §7.7
TO_UTF8 TO_UTF8(x) 1 strict §7.7
TRIM TRIM(x) 1 strict §7.5
TRUNC TRUNC(x) 1 strict §7.6
UPPER UPPER(x) 1 strict §7.5

Binding forms

For each binding builtin, the accepted argument lists in the order the evaluator tries them. outer arguments are evaluated where the call is; a binder is a bare name, not evaluated; body, key, proj and pred run once per element with the listed names bound (plus every binder). A guard says which form a count takes when two would fit.

Name Arguments Guard Bound inside
ALL source, body _ _K
ALL source, binder, body _K
ANY source, body _ _K
ANY source, binder, body _K
BUCKET source, key _ _K
BUCKET source, binder, key argument 2 is a bare name _K
BUCKET source, key, proj _ _K
BUCKET source, binder, key, proj _K
FILTER source, body _ _K
FILTER source, binder, body _K
LINK source, source, pred _ _1 _2 _K
LINK source, source, binder, binder, pred _ _1 _2 _K
LINK_LEFT source, source, pred _ _1 _2 _K
LINK_LEFT source, source, binder, binder, pred _ _1 _2 _K
MAP source, body _ _K
MAP source, binder, body _K
SORT source _ _K
SORT source, body _ _K
SORT source, binder, body _K
SORT_BY source, key _ _K
SORT_BY source, key, outer argument 3 is a text literal _ _K
SORT_BY source, binder, key argument 2 is a bare name _K
SORT_BY source, key, outer _ _K
SORT_BY source, binder, key, outer _K
SORT_DESC source _ _K
SORT_DESC source, body _ _K
SORT_DESC source, binder, body _K
SUM source, body _ _K
SUM source, binder, body _K
TOP source, outer _ _K
TOP source, body, outer _ _K
TOP source, binder, body, outer _K
TOP_BY source, key, outer _ _K
TOP_BY source, key, outer, outer argument 3 is a text literal _ _K
TOP_BY source, binder, key, outer argument 2 is a bare name _K
TOP_BY source, key, outer, outer _ _K
TOP_BY source, binder, key, outer, outer _K
TOP_DESC source, outer _ _K
TOP_DESC source, body, outer _ _K
TOP_DESC source, binder, body, outer _K

78 builtins: 19 lazy, of which 14 bind; extra arity rules on COND, LINK, LINK_LEFT, RECORD.

View this page's Markdown on GitHub