Functions and operators​

Function syntax​

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

  1. e.str_upper(e.str("hello"));
  2. // str_upper("hello")
  3. e.plus(e.int64(2), e.int64(2));
  4. // 2 + 2
  5. const nums = e.set(e.int64(3), e.int64(5), e.int64(7))
  6. e.in(e.int64(4), nums);
  7. // 4 in {3, 5, 7}
  8. e.math.mean(nums);
  9. // math::mean({3, 5, 7})

Operator syntax​

By comparison, operators do not each have a corresponding function on the e object. Instead, use the e.op function.

Unary operators

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

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

Binary operators

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

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

Ternary operators

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

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

Operator reference

Prefix operators

“exists” “distinct” “not”

Infix operators

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

Ternary operators

“if”/“else”