Skip to main content

Module calc

Module calc 

Source
Expand description

improv_calc(formula [, inputs]): one scalar Improv formula over named inputs, the engine’s own per-cell operators ([improv_engine::scalar]), as LANGUAGE improv evaluates a function body.

Inputs are a JSON object. Each key is an input measure; its value’s JSON type gives the measure’s type (number, boolean, text; a JSON null is a missing input, which makes a result that depends on it NULL). Compiled formulas are cached by formula text and input names and types, so a column of rows with the same shape compiles once.

Structs§

Cache
A bounded cache of compiled formulas, shared by every thread.
Compiled
A formula compiled against its inputs’ names and types.

Functions§

compile
Compile formula with these inputs’ names and types.
number
improv_calc’s value: a number, a boolean as 1 or 0, a date as its spreadsheet serial (days since 1899-12-30); text and errors are NULL.
parse_inputs
Parse a JSON object of inputs. A SQL NULL inputs argument is no inputs. Keys keep their order; a nested array or object is an error.

Type Aliases§

Inputs
The inputs of one call, by name, in key order.