@colibri-engine/structural v2.0.4
Structural library
Presentation
The engine is based on incremental computation algorithms. When a calculation is submitted to the engine, all the computed values are memorized. So, if you change some variable and query an evaluation, the engine is able to compute the result very fast because it recomputes only what has changed.
Libraries
The API provides several libraries that each comes with dozens of operators.
- @colibri-engine/boolean
- @colibri-engine/number
- @colibri-engine/string
- @colibri-engine/date
- @colibri-engine/dictionary
- @colibri-engine/math
Imports
Typescript
import {/* required operators */} from '@colibri-engine/structural';
Javascript
const {/* required operators */} = require('@colibri-engine/structural');
Operators
If
If(xboolean).boolean.then(y1boolean).else(y2boolean) ➜ zboolean
If(xboolean).number.then(y1number).else(y2number) ➜ znumber
If(xboolean).string.then(y1string).else(y2string) ➜ zstring
If(xboolean).date.then(y1date).else(y2date) ➜ zdate
If(xboolean).dictionary.then(y1dictionary).else(y2dictionary) ➜ zdictionary
The If operator allows to create a typed expression which evals to a node value depends on a boolean node evaluation.
import {number} from "@colibri-engine/number";
import {If} from "@colibri-engine/structural";
const x = boolean();
const y1 = number();
const y2 = number();
const z = If(x).number.then(y1).else(y2);