🐐 ORDINA with comparitor

This commit is contained in:
2026-04-25 18:50:37 +02:00
parent 8d06407527
commit 5e4c7350a9
9 changed files with 126 additions and 18 deletions

View File

@@ -357,9 +357,18 @@ Returns the length of `array` (element count), `string` (character count), or `d
Returns the keys of `dict` as an array.
### ORDINA
`ORDINA(array)`
`ORDINA(array)` or `ORDINA(array, comparator)`
Sorts an array in ascending order. Returns a new sorted array. All elements must be the same type — integers, fractions, or strings. Integers and fractions sort numerically; strings sort lexicographically.
Sorts an array. Returns a new sorted array; the original is unchanged.
Without a comparator, sorts in ascending order. All elements must be the same type — integers, fractions, or strings. Integers and fractions sort numerically; strings sort lexicographically.
With a comparator, the type-uniformity rule is dropped — the comparator decides ordering. The comparator must be a function of exactly two parameters and must return `VERAX`. `comparator(a, b)` returns `VERITAS` iff `a` should come **before** `b`; two elements are treated as equal when both `comparator(a, b)` and `comparator(b, a)` are `FALSITAS`.
![ORDINA with comparator](snippets/ordina_cmp.png)
```
> [V III II I]
```
### ADDE
`ADDE(array, value)`