https://github.com/mesopelagique/formula_compose
Chained formula executions
https://github.com/mesopelagique/formula_compose
4d-code 4d-component
Last synced: about 1 month ago
JSON representation
Chained formula executions
- Host: GitHub
- URL: https://github.com/mesopelagique/formula_compose
- Owner: mesopelagique
- License: mit
- Created: 2020-02-07T11:10:53.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2020-02-17T08:59:15.000Z (about 5 years ago)
- Last Synced: 2024-07-29T16:17:11.113Z (9 months ago)
- Topics: 4d-code, 4d-component
- Language: 4D
- Homepage: https://mesopelagique.github.io/formula_compose/
- Size: 16.6 KB
- Stars: 3
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://developer.4d.com/)
[](https://developer.4d.com/)

[](https://github.com/mesopelagique/formula_compose/releases/latest)
[](LICENSE)# ⛓ Formula Composition
Create a new `Formula` from a list of `Formula`.

Result of previous `Formula` computation is used as parameter for the next one. So you can chain multiple operations.
## Examples
```4d
$result:=formula_compose (Formula($1+1);Formula($1+2)).call(Null;0) // (0 + 1) + 2 = 3// or using collection
$formulas:=New collection(Formula($1+1);Formula($1+2)) // add one then add 2
$result:=formula_compose ($formulas).call(Null;0) // (0 + 1) + 2 = 3
```### Assigning to an object
```4d
$operation:=New object("compute";formula_compose ($formulas))
$result:=$operation.compute(3) // (3 + 1) + 2 = 5
```more in [formula_compose](Documentation/Methods/formula_compose.md)