XVal
XVal is a expression/formula evaluation language. It operates on a value structure that’s mostly isomorphic to JSON. Its computations do not have side effects.
Functions
Functions technically take one argument, but they can be chained so a function can return a function, which can return a new function etc. The value bound to the argument of each function is in scope in the inner functions. This creates the effect of multiple argument functions.
Input parameters
Each input parameter is prefixed with a single backslash \ and ends with a single right arrow ->.
Body
The body applies logic to the input parameters and returns an object. The object returned will reflect the construction of the logic, and can for example be either primitive type, a single JSON object or a JSON list.
Functions that takes one parameter
Functions that take two parameters
The example below takes a single parameter tx, and since the body is wrapped into curly braces {}, the result will be a JSON object.
Last updated
Was this helpful?