Namespace zmbt::expr¶
Namespace List > zmbt > expr
Expression Language API.
Public Attributes¶
| Type | Name |
|---|---|
| lang::SignatureUnary<::zmbt::lang::Keyword::Abs > const | Abs Absolute value. |
| lang::SignatureUnary<::zmbt::lang::Keyword::Acos > const | Acos Arccos function. |
| lang::SignatureUnary<::zmbt::lang::Keyword::Acosh > const | Acosh Hyperbolic arccos. |
| lang::SignatureBinary<::zmbt::lang::Keyword::Add > const | Add Addition. |
| lang::SignatureVariadic<::zmbt::lang::Keyword::All > const | All Match all predicates. |
| lang::SignatureBinary<::zmbt::lang::Keyword::And > const | And Logical and. |
| lang::SignatureVariadic<::zmbt::lang::Keyword::Any > const | Any Match any predicate. |
| lang::SignatureBinary<::zmbt::lang::Keyword::Near > const | Approx Alias for Near. |
| lang::SignatureUnary<::zmbt::lang::Keyword::Arange > const | Arange Generate range of numbers. |
| lang::SignatureBinary<::zmbt::lang::Keyword::Argmax > const | Argmax Max value index by key function. |
| lang::SignatureBinary<::zmbt::lang::Keyword::Argmin > const | Argmin Min value index by key function. |
| lang::SignatureUnary<::zmbt::lang::Keyword::Asin > const | Asin Arcsin function. |
| lang::SignatureUnary<::zmbt::lang::Keyword::Asinh > const | Asinh Hyperbolic arcsin. |
| lang::SignatureBinary<::zmbt::lang::Keyword::Assert > const | Assert Return argument if it holds assertion or error otherwise. |
| lang::SignatureBinary<::zmbt::lang::Keyword::At > const | At |
| lang::SignatureUnary<::zmbt::lang::Keyword::Atan > const | Atan Arctan function. |
| lang::SignatureUnary<::zmbt::lang::Keyword::Atanh > const | Atanh Hyperbolic arctan. |
| lang::SignatureUnary<::zmbt::lang::Keyword::Avg > const | Avg Arythmetic average. |
| lang::SignatureBinary<::zmbt::lang::Keyword::Bind > const | Bind Bind design-time parameters to function. |
| lang::SignatureBinary<::zmbt::lang::Keyword::BitAnd > const | BitAnd Bitwise and. |
| lang::SignatureUnary<::zmbt::lang::Keyword::BitNot > const | BitNot Bitwise not. |
| lang::SignatureBinary<::zmbt::lang::Keyword::BitOr > const | BitOr Bitwise or. |
| lang::SignatureBinary<::zmbt::lang::Keyword::BitXor > const | BitXor Bitwise xor. |
| lang::SignatureUnary<::zmbt::lang::Keyword::Bool > const | Bool Predicate on boolean transform (aka truthy) |
| lang::SignatureBinary<::zmbt::lang::Keyword::Q > const | C Alias for Q. |
| lang::SignatureUnary<::zmbt::lang::Keyword::Capitalize > const | Capitalize Capitalize string. |
| lang::SignatureUnary<::zmbt::lang::Keyword::Card > const | Card Set cardinality (uniques count) |
| lang::SignatureUnary<::zmbt::lang::Keyword::Cartesian > const | Cartesian Cartesian product. |
| lang::SignatureCast const | Cast Reserialize decorated type as decorator. |
| lang::SignatureBinary<::zmbt::lang::Keyword::Cat > const | Cat Concatenate sequences. |
| lang::SignatureUnary<::zmbt::lang::Keyword::Ceil > const | Ceil Ceil. |
| lang::SignatureBinary<::zmbt::lang::Keyword::Chunks > const | Chunks Split into chunks of specified max width. |
| lang::SignatureBinary<::zmbt::lang::Keyword::Cat > const | Concat Alias for Cat. |
| lang::SignatureBinary<::zmbt::lang::Keyword::Q > const | Const Alias for Q. |
| lang::SignatureBinary<::zmbt::lang::Keyword::Ni > const | Contains Alias for Ni. |
| lang::SignatureUnary<::zmbt::lang::Keyword::Cos > const | Cos Cosinus function. |
| lang::SignatureUnary<::zmbt::lang::Keyword::Cosh > const | Cosh Hyperbolic cos. |
| lang::SignatureBinary<::zmbt::lang::Keyword::Count > const | Count Count matches by predicate param. |
| lang::SignatureBinary<::zmbt::lang::Keyword::D > const | D Return x if not null, else return default value. |
| lang::SignatureBinary<::zmbt::lang::Keyword::Dbg > const | Dbg Evaluate function and print evaluation log to stderr. |
| lang::SignatureBinary<::zmbt::lang::Keyword::Dbg > const | Debug Alias for Dbg. |
| lang::SignatureCast const | Decorate Alias for Cast. |
| lang::SignatureBinary<::zmbt::lang::Keyword::D > const | Default Alias for D. |
| lang::SignatureBinary<::zmbt::lang::Keyword::Del > const | Del Delete elements from structure by given query. |
| lang::SignatureBinary<::zmbt::lang::Keyword::Del > const | Delete Alias for Del. |
| lang::SignatureBinary<::zmbt::lang::Keyword::Diff > const | Diff Set difference. |
| lang::SignatureBinary<::zmbt::lang::Keyword::Div > const | Div Division. |
| lang::SignatureConst<::zmbt::lang::Keyword::E > const | E Euler's number. |
| lang::SignatureBinary<::zmbt::lang::Keyword::Each > const | Each Test predicate for each item in a sequence. |
| lang::SignatureVariadic<::zmbt::lang::Keyword::Elif > const | Elif Else if. |
| lang::SignatureBinary<::zmbt::lang::Keyword::Else > const | Else Else. |
| lang::SignatureUnary<::zmbt::lang::Keyword::Enumerate > const | Enumerate Enumerate sequence. |
| lang::SignatureBinary<::zmbt::lang::Keyword::EnvLoad > const | EnvLoad Load value from the test environment using json pointer. |
| lang::SignatureBinary<::zmbt::lang::Keyword::EnvStore > const | EnvStore Store value in the test environment using json pointer. |
| lang::SignatureConst<::zmbt::lang::Keyword::Eps > const | Eps Machine epsilon. |
| lang::SignatureBinary<::zmbt::lang::Keyword::Eq > const | Eq Is equal. |
| lang::SignatureUnary<::zmbt::lang::Keyword::Erf > const | Erf Error function. |
| lang::SignatureUnary<::zmbt::lang::Keyword::Erfc > const | Erfc Error function complement. |
| lang::SignatureErr const | Err Error object. |
| lang::SignatureErr const | Error Alias for Err. |
| lang::SignatureBinary<::zmbt::lang::Keyword::Eval > const | Eval Flip designtime and run-time parameters, evaluating input as expression. |
| lang::SignatureUnary<::zmbt::lang::Keyword::Exp > const | Exp Exponential (e^x) |
| lang::SignatureConst<::zmbt::lang::Keyword::False > const | False Logical false. |
| lang::SignatureUnary<::zmbt::lang::Keyword::Not > const | Falsy Alias for Not. |
| lang::SignatureBinary<::zmbt::lang::Keyword::Filter > const | Filter Filter sequence by predicate param. |
| lang::SignatureBinary<::zmbt::lang::Keyword::Find > const | Find Find the first element that satisfies given predicate. |
| lang::SignatureBinary<::zmbt::lang::Keyword::FindIdx > const | FindIdx Find index of the first element that satisfies given predicate. |
| lang::SignatureBinary<::zmbt::lang::Keyword::FindPtr > const | FindPtr Find json pointer of the first element that satisfies given predicate. |
| lang::SignatureUnary<::zmbt::lang::Keyword::First > const | First First item of sequence. |
| lang::SignatureUnary<::zmbt::lang::Keyword::Flatten > const | Flatten Flatten nested list. |
| lang::SignatureBinary<::zmbt::lang::Keyword::Flip > const | Flip Flip design-time and eval-time parameters. |
| lang::SignatureUnary<::zmbt::lang::Keyword::Floor > const | Floor Floor. |
| lang::SignatureVariadic<::zmbt::lang::Keyword::Fmt > const | Fmt Format string with the given parameter list. |
| lang::SignatureVariadic<::zmbt::lang::Keyword::Fn > const | Fn Symbolic binding of the inline function. |
| lang::SignatureBinary<::zmbt::lang::Keyword::Fold > const | Fold Reduce sequence with binary operator. |
| lang::SignatureVariadic<::zmbt::lang::Keyword::Fork > const | Fork Pack results from enveloped functions into an array. |
| lang::SignatureVariadic<::zmbt::lang::Keyword::Fmt > const | Format Alias for Fmt. |
| lang::SignatureUnary<::zmbt::lang::Keyword::Gamma > const | Gamma Gamma function. |
| lang::SignatureBinary<::zmbt::lang::Keyword::Ge > const | Ge Greater or equal. |
| lang::SignatureBinary<::zmbt::lang::Keyword::Get > const | Get Load linked value (maybe a closure) or return null. |
| lang::SignatureBinary<::zmbt::lang::Keyword::Gt > const | Gt Greater than. |
| lang::SignatureUnary<::zmbt::lang::Keyword::Id > const | Id Identity function. |
| lang::SignatureVariadic<::zmbt::lang::Keyword::If > const | If Branching operator. |
| lang::SignatureBinary<::zmbt::lang::Keyword::In > const | In Element is in. |
| lang::SignatureConst<::zmbt::lang::Keyword::Inf > const | Inf Infinity. |
| lang::SignatureBinary<::zmbt::lang::Keyword::Intersect > const | Intersect Set intersection. |
| lang::SignatureUnary<::zmbt::lang::Keyword::IsErr > const | IsErr Test the argument is err expression. |
| lang::SignatureUnary<::zmbt::lang::Keyword::IsErr > const | Iserror Alias for IsErr. |
| lang::SignatureUnary<::zmbt::lang::Keyword::Items > const | Items Extract key-value pairs from object. |
| lang::SignatureUnary<::zmbt::lang::Keyword::Keys > const | Keys Extract keys from object. |
| lang::SignatureUnary<::zmbt::lang::Keyword::Kwrd > const | Kwrd Introspect expression keyword. |
| lang::SignatureUnary<::zmbt::lang::Keyword::Last > const | Last Last item of sequence. |
| lang::SignatureBinary<::zmbt::lang::Keyword::Le > const | Le Lesser or equal. |
| lang::SignatureBinary<::zmbt::lang::Keyword::Link > const | Link Symbolic binding of the input value. |
| lang::SignatureBinary<::zmbt::lang::Keyword::Log > const | Log Logarithm. |
| lang::SignatureBinary<::zmbt::lang::Keyword::Lookup > const | Lookup Lookup table function. |
| lang::SignatureUnary<::zmbt::lang::Keyword::LowerCase > const | LowerCase Lower case string. |
| lang::SignatureBinary<::zmbt::lang::Keyword::Lshift > const | Lshift Bitwise left shift. |
| lang::SignatureBinary<::zmbt::lang::Keyword::Lt > const | Lt Lesser than. |
| lang::SignatureBinary<::zmbt::lang::Keyword::Map > const | Map Apply param expr to every element of sequence. |
| lang::SignatureBinary<::zmbt::lang::Keyword::Max > const | Max Max value by key function. |
| lang::SignatureBinary<::zmbt::lang::Keyword::Min > const | Min Min value by key function. |
| lang::SignatureBinary<::zmbt::lang::Keyword::Mod > const | Mod Modulo. |
| lang::SignatureBinary<::zmbt::lang::Keyword::Mul > const | Mul Multiplication. |
| lang::SignatureConst<::zmbt::lang::Keyword::NaN > const | NaN Not a number. |
| lang::SignatureBinary<::zmbt::lang::Keyword::Ne > const | Ne Not equal. |
| lang::SignatureBinary<::zmbt::lang::Keyword::Near > const | Near Floating point approximately equal. |
| lang::SignatureUnary<::zmbt::lang::Keyword::Neg > const | Neg Negate. |
| lang::SignatureBinary<::zmbt::lang::Keyword::Ni > const | Ni Contains element. |
| lang::SignatureUnary<::zmbt::lang::Keyword::Not > const | Nil Alias for Not. |
| lang::SignatureConst<::zmbt::lang::Keyword::Noop > const | Noop No operation. |
| lang::SignatureUnary<::zmbt::lang::Keyword::Not > const | Not Logical complement. |
| lang::SignatureBinary<::zmbt::lang::Keyword::NotIn > const | NotIn Element is not in. |
| lang::SignatureBinary<::zmbt::lang::Keyword::NotNi > const | NotNi Not contains element. |
| lang::SignatureConst<::zmbt::lang::Keyword::Null > const | Null Null value. |
| lang::SignatureOp const | Op Bind type-specific operator handler to function. |
| lang::SignatureBinary<::zmbt::lang::Keyword::Or > const | Or Logical or. |
| lang::SignatureOp const | Overload Alias for Op. |
| lang::SignatureBinary<::zmbt::lang::Keyword::PSubset > const | PSubset Is proper subset. |
| lang::SignatureBinary<::zmbt::lang::Keyword::PSuperset > const | PSuperset Is proper superset. |
| lang::SignatureUnary<::zmbt::lang::Keyword::Prms > const | Parameters Alias for Prms. |
| lang::SignatureUnary<::zmbt::lang::Keyword::Parse > const | Parse Parse string as json. |
| lang::SignatureConst<::zmbt::lang::Keyword::Pi > const | Pi Pi constant. |
| lang::SignatureVariadic<::zmbt::lang::Keyword::Pipe > const | Pipe Pipe functions in left-to-right composition. |
| lang::SignatureBinary<::zmbt::lang::Keyword::Pow > const | Pow To power. |
| lang::SignatureBinary<::zmbt::lang::Keyword::PreProc > const | PreProc Preprocessing token. |
| lang::SignatureUnary<::zmbt::lang::Keyword::Prms > const | Prms Introspect expression parameters. |
| lang::SignatureUnary<::zmbt::lang::Keyword::Prod > const | Prod Multiplication reduction. |
| lang::SignatureBinary<::zmbt::lang::Keyword::Push > const | Push Push element into a front of sequence. |
| lang::SignatureBinary<::zmbt::lang::Keyword::Q > const | Q Quote parameter, similar to lisp quotation. |
| lang::SignatureBinary<::zmbt::lang::Keyword::Quot > const | Quot Quotient. |
| lang::SignatureUnary<::zmbt::lang::Keyword::Rand > const | Rand Uniformly distributed random number in the half-open interval [0.0, 1.0) |
| lang::SignatureVariadic<::zmbt::lang::Keyword::RandInt > const | RandInt Uniformly distributed random integer in the given range. |
| lang::SignatureBinary<::zmbt::lang::Keyword::Re > const | Re Regular expression match. |
| lang::SignatureVariadic<::zmbt::lang::Keyword::Recur > const | Recur Apply recursion to parameter expr and initial value. |
| lang::SignatureBinary<::zmbt::lang::Keyword::Fold > const | Reduce Alias for Fold. |
| lang::SignatureBinary<::zmbt::lang::Keyword::Re > const | Regex Alias for Re. |
| lang::SignatureBinary<::zmbt::lang::Keyword::Repeat > const | Repeat Repeat value in list. |
| lang::SignatureUnary<::zmbt::lang::Keyword::Reverse > const | Reverse Reverse sequence. |
| lang::SignatureUnary<::zmbt::lang::Keyword::Round > const | Round Round to nearest integer. |
| lang::SignatureBinary<::zmbt::lang::Keyword::Rshift > const | Rshift Bitwise right shift. |
| lang::SignatureVariadic<::zmbt::lang::Keyword::Saturate > const | Saturate Saturate matches in order. |
| lang::SignatureBinary<::zmbt::lang::Keyword::Sequence > const | Seq Alias for Sequence. |
| lang::SignatureBinary<::zmbt::lang::Keyword::Sequence > const | Sequence Produce sequence from parameter using arg as size. |
| lang::SignatureUnary<::zmbt::lang::Keyword::Str > const | Serialize Alias for Str. |
| lang::SignatureBinary<::zmbt::lang::Keyword::SetEq > const | SetEq Equal as set. |
| lang::SignatureUnary<::zmbt::lang::Keyword::Sign > const | Sign Sign. |
| lang::SignatureUnary<::zmbt::lang::Keyword::Sin > const | Sin Sinus function. |
| lang::SignatureUnary<::zmbt::lang::Keyword::Sinh > const | Sinh Hyperbolic sin. |
| lang::SignatureUnary<::zmbt::lang::Keyword::Size > const | Size Sequence size. |
| lang::SignatureBinary<::zmbt::lang::Keyword::Slide > const | Slide Sliding-window iteration. |
| lang::SignatureBinary<::zmbt::lang::Keyword::Sort > const | Sort Sort list by key function. |
| lang::SignatureUnary<::zmbt::lang::Keyword::Sqrt > const | Sqrt Square root. |
| lang::SignatureUnary<::zmbt::lang::Keyword::Str > const | Str Serialize json as string. |
| lang::SignatureBinary<::zmbt::lang::Keyword::Stride > const | Stride Striding iteration. |
| lang::SignatureBinary<::zmbt::lang::Keyword::Sub > const | Sub Subtraction. |
| lang::SignatureBinary<::zmbt::lang::Keyword::Subset > const | Subset Is subset. |
| lang::SignatureUnary<::zmbt::lang::Keyword::Sum > const | Sum Summation reduction. |
| lang::SignatureBinary<::zmbt::lang::Keyword::Superset > const | Superset Is superset. |
| lang::SignatureUnary<::zmbt::lang::Keyword::Tan > const | Tan Tangens function. |
| lang::SignatureUnary<::zmbt::lang::Keyword::Tanh > const | Tanh Hyperbolic tan. |
| lang::SignatureConst<::zmbt::lang::Keyword::Thread > const | Thread Thread id. |
| lang::SignatureUnary<::zmbt::lang::Keyword::ToList > const | ToList Put argument into a list. |
| lang::SignatureBinary<::zmbt::lang::Keyword::Trace > const | Trace Same as id, but also prints identifier parameter to debug log. |
| lang::SignatureUnary<::zmbt::lang::Keyword::Transp > const | Transp Transpose multidimensional list, turning rows into columns. |
| lang::SignatureConst<::zmbt::lang::Keyword::True > const | True Logical true. |
| lang::SignatureUnary<::zmbt::lang::Keyword::Bool > const | Truthy Alias for Bool. |
| lang::SignatureBinary<::zmbt::lang::Keyword::Try > const | Try Evaluate function and return result or null if it returns error. |
| lang::SignatureVariadic<::zmbt::lang::Keyword::Tuple > const | Tuple Pack expressions into an tuple without evaluation. |
| lang::SignatureUncast const | Uncast Reserialize decorator as decorated type. |
| lang::SignatureUncast const | Undecorate Alias for Uncast. |
| lang::SignatureVariadic<::zmbt::lang::Keyword::Unfold > const | Unfold Put results of recursive fn call on initial value into an array. |
| lang::SignatureBinary<::zmbt::lang::Keyword::Union > const | Union Set union. |
| lang::SignatureUnary<::zmbt::lang::Keyword::Uniques > const | Uniques Filter unique elements. |
| lang::SignatureUnary<::zmbt::lang::Keyword::UpperCase > const | UpperCase Upper case string. |
| lang::SignatureUnary<::zmbt::lang::Keyword::Values > const | Values Extract values from object. |
| lang::SignatureConst<::zmbt::lang::Keyword::Noop > const | _ Alias for Noop. |
Public Attributes Documentation¶
variable Abs¶
Absolute value.
variable Acos¶
Arccos function.
variable Acosh¶
Hyperbolic arccos.
variable Add¶
Addition.
variable All¶
Match all predicates.
variable And¶
Logical and.
Generic behavior: if first operand is truthy, returns second operand, otherwise first
variable Any¶
Match any predicate.
variable Approx¶
Alias for Near.
variable Arange¶
Generate range of numbers.
Return evenly spaced values within a given interval.
Parameters:
- start: start value
- stop: stop value
- step: step value
Parameters dynamic evaluation:
- stop: int -> [0, stop, 1]
- [start, stop] -> [start, stop, 1]
- [start, stop, step] -> [start, stop, step]
variable Argmax¶
Max value index by key function.
variable Argmin¶
Min value index by key function.
variable Asin¶
Arcsin function.
variable Asinh¶
Hyperbolic arcsin.
variable Assert¶
Return argument if it holds assertion or error otherwise.
variable At¶
$
Structure index is evaluated as array index or as key-value pair index for objects on order-preserving backends.
Result is null if requested element not found.
variable Atan¶
Arctan function.
variable Atanh¶
Hyperbolic arctan.
variable Avg¶
Arythmetic average.
variable Bind¶
Bind design-time parameters to function.
variable BitAnd¶
Bitwise and.
variable BitNot¶
Bitwise not.
variable BitOr¶
Bitwise or.
variable BitXor¶
Bitwise xor.
variable Bool¶
Predicate on boolean transform (aka truthy)
variable C¶
Alias for Q.
variable Capitalize¶
Capitalize string.
variable Card¶
Set cardinality (uniques count)
variable Cartesian¶
Cartesian product.
variable Cast¶
Reserialize decorated type as decorator.
variable Cat¶
Concatenate sequences.
variable Ceil¶
Ceil.
variable Chunks¶
Split into chunks of specified max width.
Similar to Stride, but includes the last subsequence smaller then step width.
variable Concat¶
Alias for Cat.
variable Const¶
Alias for Q.
variable Contains¶
Alias for Ni.
variable Cos¶
Cosinus function.
variable Cosh¶
Hyperbolic cos.
variable Count¶
Count matches by predicate param.
variable D¶
Return x if not null, else return default value.
variable Dbg¶
Evaluate function and print evaluation log to stderr.
variable Debug¶
Alias for Dbg.
variable Decorate¶
Alias for Cast.
variable Default¶
Alias for D.
variable Del¶
Delete elements from structure by given query.
Possible queries: * Structure index (negative resolves as reverse) * JSON Pointer * List of queries
Structure index is evaluated as array index or as key-value pair index for objects on order-preserving backends. When deleting an object element, resulting items order may change.
variable Delete¶
Alias for Del.
variable Diff¶
Set difference.
variable Div¶
Division.
- \([ ] \mapsto [x, y] \mapsto x / y\)
- \([y] \mapsto [x] \mapsto x / y\)
variable E¶
Euler's number.
variable Each¶
Test predicate for each item in a sequence.
Equivalent to Count(p | Not) | Eq(0)
variable Elif¶
Else if.
Continuation operator in If-Elif-Else pipe. Will fail if not preceded by If. See If.
variable Else¶
Else.
Resolving operator in If-Elif-Else pipe. Will fail if not preceded by If or Elif. See If.
variable Enumerate¶
Enumerate sequence.
Enumerate sequence with index.
variable EnvLoad¶
Load value from the test environment using json pointer.
Load the the value from a global environment table with a given JSON Pointer.
variable EnvStore¶
Store value in the test environment using json pointer.
Capture the argument value and store it in a global environment table with a given JSON Pointer, passing the value further similarly to Link.
variable Eps¶
Machine epsilon.
variable Eq¶
Is equal.
variable Erf¶
Error function.
variable Erfc¶
Error function complement.
variable Err¶
Error object.
Error object handling the message and context info
variable Error¶
Alias for Err.
variable Eval¶
Flip designtime and run-time parameters, evaluating input as expression.
variable Exp¶
Exponential (e^x)
variable False¶
Logical false.
variable Falsy¶
Alias for Not.
variable Filter¶
Filter sequence by predicate param.
variable Find¶
Find the first element that satisfies given predicate.
variable FindIdx¶
Find index of the first element that satisfies given predicate.
Similar to FindPtr, but will integer index or nullptr for non-indexable input. Objects are processed as list of key-value pairs.
variable FindPtr¶
Find json pointer of the first element that satisfies given predicate.
variable First¶
First item of sequence.
Equivalent to At(0)
variable Flatten¶
Flatten nested list.
variable Flip¶
Flip design-time and eval-time parameters.
Useful for binding lhs operands to non-commutative operators. Unlike Haskell's flip, won't change the order or eval-time parameters - for that case use the Reverse keyword instead.
Prefix operator form (tilde):
Flip(Div(1)) ≡ ~Div(1)
variable Floor¶
Floor.
variable Fmt¶
Format string with the given parameter list.
Constant expressions are supported for the token list, s.t. "%s" | Fmt(Pi) produces "3.141592653589793E0"
variable Fn¶
Symbolic binding of the inline function.
Expression Fn(reference, expr) creates a symbolic binding between the given reference and an expression, making the expression callable by name within the evaluation context.
The referenced expression is inlined at the call site and evaluated with the current input. The reference is available to the bound expression itself and to all its subexpressions, enabling arbitrary recursion.
Each invocation of a function bound with Fn establishes a local scope for argument bindings created via Link, forming a lexical closure over the surrounding bindings. Argument links from outer scopes are captured by the function and remain accessible unless shadowed by a local binding. Such captured values can be explicitly read using the Get expression
Function bindings are shared across the whole expression and are immutable: once a reference is bound with Fn, it cannot be redefined or reset.
Infix operator form (left shift):
"$f" << E ≡ Fn("$f", E)
variable Fold¶
Reduce sequence with binary operator.
To set a specific initial value, use composition with Push, e.g. Push(0) | Fold(Add)
For reverse operation, see Unfold
variable Fork¶
Pack results from enveloped functions into an array.
Parallel composition operator:
variable Format¶
Alias for Fmt.
variable Gamma¶
Gamma function.
variable Ge¶
Greater or equal.
variable Get¶
Load linked value (maybe a closure) or return null.
Explicitly load the value bound to a symbolic reference without triggering capture semantics.
In contexts where a $-prefixed reference would otherwise attempt to initialize a new binding, Get forces a read of an existing binding from the nearest enclosing scope. If no such binding exists, null is returned.
This is particularly useful when working with immutable closures and recursive expressions, where it is necessary to distinguish between reading an upvalue and introducing a new local binding.
variable Gt¶
Greater than.
variable Id¶
Identity function.
variable If¶
Branching operator.
Branching operator can be used either in Lisp-like mode as If(predicate, then_expr, else_expr), or in pipe mode with Elif or Else operators (see examples).
In pipe mode (without else_expr parameter), the chain will produce error if the following order is violated or interrupted: If [ Elif ]* Else
In both modes, then_expr and else_expr are lazy evaluated against run-time argument (which is also true for Elif and Else), making it possible to nest if-else expressions.
variable In¶
Element is in.
variable Inf¶
Infinity.
variable Intersect¶
Set intersection.
variable IsErr¶
Test the argument is err expression.
variable Iserror¶
Alias for IsErr.
variable Items¶
Extract key-value pairs from object.
variable Keys¶
Extract keys from object.
variable Kwrd¶
Introspect expression keyword.
variable Last¶
Last item of sequence.
Equivalent to At(-1)
variable Le¶
Lesser or equal.
variable Link¶
Symbolic binding of the input value.
Capture the current input value and associate it with a symbolic reference represented by a dollar-prefixed string, e.g. "$x".
On its first evaluation, the reference stores the input value (similar to variable initialization) and passes the value further through the pipeline. On subsequent evaluations within the same scope, the stored value is returned, acting as an immutable constant.
A Link instance cannot be reset after its first access. However, it may be shadowed by another binding with the same reference name in a nested scope, such as a recursive call created with Fn.
The reference name following the $ sign must not be enclosed in [], {}, or (), as those formats are reserved for internal use.
variable Log¶
Logarithm.
Logarithm with base b:
- \([ ] \mapsto [x, b] \mapsto log\_b(x)\)
- \([b] \mapsto [x] \mapsto log\_b(x)\)
variable Lookup¶
Lookup table function.
Parametrized at design time with fixed array or object, produces the value at corresponding At query given as eval-time argument. Equivalent to ~At(...)
variable LowerCase¶
Lower case string.
variable Lshift¶
Bitwise left shift.
- \([ ] \mapsto [x, s] \mapsto x \texttt{ << } s\)
- \([s] \mapsto [x] \mapsto x \texttt{ << } s\)
variable Lt¶
Lesser than.
variable Map¶
Apply param expr to every element of sequence.
variable Max¶
Max value by key function.
variable Min¶
Min value by key function.
variable Mod¶
Modulo.
Modulo of x:
- \([ ] \mapsto [x, m] \mapsto x % m\)
- \([m] \mapsto [x] \mapsto x % m\)
variable Mul¶
Multiplication.
variable NaN¶
Not a number.
variable Ne¶
Not equal.
variable Near¶
Floating point approximately equal.
Based on numpy.isclose:
abs(x - ref) <= (atol + rtol * abs(ref))
Rhs parameters:
ref: reference value rtol: relative tolerance, default = 1e-05 atol: absolute tolerance, default = 1e-08
Rhs dynamic evaluation:
- ref -> [ref, default, default]
- [ref] -> [ref, default, default]
- [ref, rtol] -> [ref, rtol , default]
- [ref, rtol, atol] -> [ref, rtol , atol ]
variable Neg¶
Negate.
variable Ni¶
Contains element.
variable Nil¶
Alias for Not.
variable Noop¶
No operation.
Returns true without input validation. Used in place of matchers for uninteresting signals.
variable Not¶
Logical complement.
variable NotIn¶
Element is not in.
variable NotNi¶
Not contains element.
variable Null¶
Null value.
variable Op¶
Bind type-specific operator handler to function.
Expression Op(op, f) instructs f to use op operator on invocation instead of the default generic.
Operator parameter singleton can be referenced with a string key or constructed in place using type<T> tag.
This operator handler is propagated downstream to all terminal subexpression in f. The result of f(x) is not decorated as type<T>.
variable Or¶
Logical or.
Generic behavior: if first operand is truthy, returns first operand, second otherwise
variable Overload¶
Alias for Op.
variable PSubset¶
Is proper subset.
variable PSuperset¶
Is proper superset.
variable Parameters¶
Alias for Prms.
variable Parse¶
Parse string as json.
variable Pi¶
Pi constant.
variable Pipe¶
Pipe functions in left-to-right composition.
variable Pow¶
To power.
X to power p * \([ ] \mapsto [x, p] \mapsto x^p\) * \([p] \mapsto [x] \mapsto x^p\)
variable PreProc¶
Preprocessing token.
String token that can be substituted with arbitrary expression on expression preprocessing.
variable Prms¶
Introspect expression parameters.
variable Prod¶
Multiplication reduction.
Equivalent to Reduce(Mul)
variable Push¶
Push element into a front of sequence.
variable Q¶
Quote parameter, similar to lisp quotation.
Quotation lifts any parameter to constant, s.t. produced expression will return the design-time parameter on evaluation, ignoring input. If evaluable expression is passed, it is returned unevaluated. Unlike plain literals which can be treated as predicate matchers in certain context, Q(x) is always a constant expression discarding input. ~Q (Flip(Q)) is equivalent to Id.
variable Quot¶
Quotient.
Quotient of x:
- \([ ] \mapsto [x, d] \mapsto x // d\)
- \([d] \mapsto [x] \mapsto x // d\)
variable Rand¶
Uniformly distributed random number in the half-open interval [0.0, 1.0)
variable RandInt¶
Uniformly distributed random integer in the given range.
RandInt(x, y) : range is [x, y] RandInt(x) : range is [0, x] for positive x and [x, 0] for negative RandInt() : range is [0, RAND_MAX]
variable Re¶
Regular expression match.
If input is not a string, match it's serialized form.
variable Recur¶
Apply recursion to parameter expr and initial value.
Inference rules:
n | Recur(x, f)\(\mapsto ◯ⁿ f(x)\), orQ(p) | Recur(x₀, f)\(\mapsto x\_k\), where- \(x\_{i+1} = f(x\_i)\)
- \(p(x\_{i}) = \top \quad \forall i \le k\)
- \(p(x\_{i+1}) = \bot\) (exit condition)
variable Reduce¶
Alias for Fold.
variable Regex¶
Alias for Re.
variable Repeat¶
Repeat value in list.
variable Reverse¶
Reverse sequence.
variable Round¶
Round to nearest integer.
Hint: To round to ndigits precision after the decimal point, use Mul(ndigits) | Round | Div(ndigits) combo.
variable Rshift¶
Bitwise right shift.
- \([ ] ↦ [x, s] ↦ x \texttt{ >> } s\)
- \([s] ↦ [x] ↦ x \texttt{ >> } s\)
variable Saturate¶
Saturate matches in order.
variable Seq¶
Alias for Sequence.
variable Sequence¶
Produce sequence from parameter using arg as size.
Behavior of n | Sequence(F)is similar to n | Flip(Repeat(F)), with the main difference that the parameter is reevaluated for each step, making it possible to utilize side-effects, s.a. with Rand.
variable Serialize¶
Alias for Str.
variable SetEq¶
Equal as set.
variable Sign¶
Sign.
variable Sin¶
Sinus function.
variable Sinh¶
Hyperbolic sin.
variable Size¶
Sequence size.
variable Slide¶
Sliding-window iteration.
Sliding window iteration by specified window width.
variable Sort¶
Sort list by key function.
variable Sqrt¶
Square root.
variable Str¶
Serialize json as string.
variable Stride¶
Striding iteration.
Striding iteration by specified step width. Reminder subsequence smaller then step width is discarded.
variable Sub¶
Subtraction.
variable Subset¶
Is subset.
variable Sum¶
Summation reduction.
Equivalent to Reduce(Add)
variable Superset¶
Is superset.
variable Tan¶
Tangens function.
variable Tanh¶
Hyperbolic tan.
variable Thread¶
Thread id.
Not really a constant, but useful for branching the test input conditions.
variable ToList¶
Put argument into a list.
Equivalent to At([""])
variable Trace¶
Same as id, but also prints identifier parameter to debug log.
variable Transp¶
Transpose multidimensional list, turning rows into columns.
May be used to zip sequences of equal length.
variable True¶
Logical true.
variable Truthy¶
Alias for Bool.
variable Try¶
Evaluate function and return result or null if it returns error.
variable Tuple¶
Pack expressions into an tuple without evaluation.
variable Uncast¶
Reserialize decorator as decorated type.
variable Undecorate¶
Alias for Uncast.
variable Unfold¶
Put results of recursive fn call on initial value into an array.
Inference rules:
n | Unfold(x, f)\(\mapsto [x\_0, x\_1, ..., x\_n]\), orQ(p) | Unfold(x₀, f)\(\mapsto [x\_0, x\_1, ..., x\_k]\), where- \(x\_{i+1} = f(x\_i)\)
- \(p(x\_{i}) = \top \quad \forall i \le k\)
- \(p(x\_{i+1}) = \bot\) (exit condition)
variable Union¶
Set union.
variable Uniques¶
Filter unique elements.
variable UpperCase¶
Upper case string.
variable Values¶
Extract values from object.
variable _¶
Alias for Noop.
The documentation for this class was generated from the following file zmbt-framework/zmbt-framework/backends/cxx/include/zmbt/expr/api.hpp