API Reference Elex v#0.4.0

View Source

Modules

Elex is an expression language library for parsing, validating, and evaluating expressions.

Ash resource validation for Elex expression strings.

Completes identifiers in an Elex expression without requiring a successful parse.

Holds variables and functions available when parsing and evaluating expressions.

A category formula as a canonical monomial of base categories.

Evaluates a parsed expression AST to a runtime value.

Behaviour for implementing custom Elex functions.

Returns the absolute value of x.

Wraps a number as a quantity of a registered unit symbol.

Returns whether x is within the inclusive range between low and high.

Returns the smallest integer greater than or equal to x.

Clamps a value to the inclusive range between min and max.

Returns the first non-null argument.

Concatenates zero or more strings.

Returns whether haystack contains needle.

Converts a quantity into a named unit or unit formula.

Decreases a value by a percent rate.

Returns whether text ends with suffix.

Returns the largest integer less than or equal to x.

Returns value1 if condition is true, otherwise value2.

Increases a value by a percent rate.

Returns the length of a string as a decimal.

Returns the lowercase form of a string.

Returns whether text matches a regular expression pattern.

Returns the larger of two or more values.

Returns the smaller of two or more values.

Returns the floored modulo of a divided by b (sign follows the divisor).

Returns the mathematical constant π (3.14159...).

Returns base raised to the power of exponent.

Returns the magnitude of a quantity as a number.

Returns x rounded to the nearest integer.

Returns the square root of x.

Returns whether text starts with prefix.

Returns a string with leading and trailing whitespace removed.

Returns the uppercase form of a string.

Inverts simple arithmetic expressions with a single variable.

Provides human-readable labels for expression types.

Parses Elex expression strings into AST tuples.

Translates low-level parser failures into human-readable error messages.

A percent stored as percent points.

A measured value with a unit.

A unit of measure as a canonical monomial.

Caller-registered unit categories.

Parses unit formulas such as m * m, kg * m | s^2, and m | s^2.

Validates a parsed expression AST for type correctness.

A named value with a type used during expression validation and evaluation.