🐐 MVTA, CRIBRA, CONFLA

This commit is contained in:
2026-04-25 20:20:54 +02:00
parent 5e4c7350a9
commit 382492a6fc
16 changed files with 225 additions and 2 deletions

View File

@@ -370,6 +370,36 @@ With a comparator, the type-uniformity rule is dropped — the comparator decide
> [V III II I]
```
### MVTA
`MVTA(array, fn)`
Returns a new array obtained by applying `fn` to every element of `array`. The original array is unchanged. `fn` must be a function of exactly one parameter; its return value is unrestricted, so `MVTA` may produce an array of a different element type than its input.
![MVTA doubling each element](snippets/mvta.png)
```
> [II IV VI VIII]
```
### CRIBRA
`CRIBRA(array, predicate)`
Returns a new array containing the elements of `array` for which `predicate` returns `VERITAS`, in their original order. The original array is unchanged. `predicate` must be a function of exactly one parameter and must return `VERAX`.
![CRIBRA keeping elements ≤ III](snippets/cribra.png)
```
> [I II III]
```
### CONFLA
`CONFLA(array, initial, fn)`
Left fold: starts with `initial` as the accumulator, then for each element `e` of `array` updates the accumulator to `fn(acc, e)`, and returns the final accumulator. The original array is unchanged. `fn` must be a function of exactly two parameters. If `array` is empty, `initial` is returned unchanged.
![CONFLA summing elements](snippets/confla.png)
```
> XVI
```
### ADDE
`ADDE(array, value)`