@compute.ts/function
v2.0.3
Published
Provide function operators for the computeTS package
Downloads
21
Maintainers
Readme
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 project provides several libraries that each comes with dozens of operators. Please note the cross-compatibility of the libraries.
- @compute.ts/boolean
- @compute.ts/number
- @compute.ts/string
- @compute.ts/date
- @compute.ts/dictionary
- @compute.ts/array
- @compute.ts/math
- @compute.ts/structural
Imports
Typescript
import {/* required operators */} from '@compute.ts/function';
Javascript
const {/* required operators */} = require('@compute.ts/function');
Operators
Function
Function.takeType.returnType.code(value) ➜ xfunction
The Function operator allows you to create an expression which evals to the result of the given fuction. If no value is provided the expression is a variable of the model
import {Function} from "@compute.ts/function";
const x = Function
.takeNumberArray
.takeNumber
.returnNumberArray
.code((array: number[], threshold: number) => {
return array.filter(value => value < threshold);
});
apply
xfunction.apply(x0type-A, x1type-B, x2type-C) ➜ xtype-return
The apply operator allows to create a boolean expression which evals to the result of the function according to the value of the agument(s)
import {Function} from "@compute.ts/function";
import {array} from "@compute.ts/array";
import {number} from "@compute.ts/number";
const x = Function
.takeNumberArray
.takeNumber
.returnNumberArray
.code((y1: number[], y2: number) => {
return y1.filter(v => v < y2);
});
const y1 = array.ofNumber([1, 2, 3, 4]);
const y2 = number();
const z = x.apply(y1, y2);
y2.affect(3)
const value = z.eval(); // [1, 2]
About the author
I am a software developer with 4 years of project specializing in the development of web solutions. Digital Nomad, I work while traveling. After 3 years into the french industry, I've started to work as a freelance software architect or fullstack developer.
Based on state-of-the-art web technologies, I offer you to architect & develop the best version of your project. My experience in the web app development assure you to build a nice looking, performant and stable product.
Minimalist, I like to travel, to meet people, learn new things and handmade stuff. Scuba & sky diving licenced. I like also hamburgers, Kinder chocolate and crepes. Karate black belt.
https://berthellemy.com/