Search
ctrl/
Ask AI
Light
Dark
System

Functions and Operators

All built-in standard library functions are reflected as functions in e.

Copy
e.str_upper(e.str("hello"));
// str_upper("hello")

e.op(e.int64(2), '+', e.int64(2));
// 2 + 2

const nums = e.set(e.int64(3), e.int64(5), e.int64(7))
e.op(e.int64(4), 'in', nums);
// 4 in {3, 5, 7}

e.math.mean(nums);
// math::mean({3, 5, 7})

Unlike functions, operators do not correspond to a top-level function on the e object. Instead, they are expressed with the e.op function.

Prefix operators operate on a single argument: OPERATOR <arg>.

Copy
e.op('not', e.bool(true));      // not true
e.op('exists', e.set('hi'));    // exists {'hi'}
e.op('distinct', e.set('hi', 'hi'));    // distinct {'hi', 'hi'}

"exists" "distinct" "not"

Infix operators operate on two arguments: <arg> OPERATOR <arg>.

Copy
e.op(e.str('Hello '), '++', e.str('World!'));
// 'Hello ' ++ 'World!'

"=" "?=" "!=" "?!=" ">=" ">" "<=" "<" "or" "and" "+" "-" "*" "/" "//" "%" "^" "in" "not in" "union" "??" "++" "like" "ilike" "not like" "not ilike"

Ternary operators operate on three arguments: <arg> OPERATOR <arg> OPERATOR <arg>. Currently there’s only one ternary operator: the if else statement.

Copy
e.op(e.str('😄'), 'if', e.bool(true), 'else', e.str('😢'));
// 😄 if true else 😢