-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
checkroom
committed
Jan 17, 2025
1 parent
e1d18fa
commit 92dac36
Showing
2 changed files
with
46 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,60 @@ | ||
Ordering criteria are used in two situations: | ||
|
||
- in `order-by` attributes of cycles of every type except `for-range` | ||
- as basic boolean binary operator in the RPN vm | ||
- in the `order-by` attributes of cycles for each type but `for-range` | ||
- as basic boolean binary operator in the RPN virtual machine | ||
|
||
The two implementations are not unified, so feature parity is desired but not intrinsic. | ||
|
||
## Order types | ||
|
||
### `ASC` & `DESC` | ||
|
||
Whatever ordinal is assigned to the entries, sorting is just based on an ascending or descending order. | ||
|
||
### `RANDOM` | ||
|
||
Data of any type is first hashed. | ||
For integers, floats and booleans this only involves their immediate data. | ||
For strings the characters buffer. Order will be based on the numerical comparison of the hash. | ||
For strings adopting the dot notation, each token is handled separately in hashing and comparing. | ||
Data of any type is first hashed, and `ASC` is applied to those hashes. | ||
For integers, floats and booleans this just involves their immediate data. | ||
For strings the characters buffer is used as the hash source. If the dot notation is needed, each token separated by `.` will be hashed and compared on its own. | ||
Nodes should not be directly compared. Doing so is not illegal, just nonsensical. | ||
|
||
## Comparison operators for supported types. | ||
|
||
### Nodes | ||
|
||
Nodes should not be directly compared. Doing so is not illegal, just nonsensical and UB. A more precise semantic for this case might be introduced later on. | ||
|
||
### Attributes | ||
|
||
By default, they are cast to string before evaluation. | ||
|
||
### Integers | ||
|
||
Comparison as expected from any basic math class. | ||
|
||
### Floats | ||
|
||
Comparison as expected from any basic math class. | ||
|
||
### Booleans | ||
|
||
`true` is smaller than `false`. | ||
|
||
### Strings | ||
|
||
Strings are by far the most complex to handle as multiple criteria are possible. | ||
Strings | ||
|
||
#### Encoding ordering | ||
|
||
Based on the binary representation of UTF-8 encoding. | ||
|
||
#### Natural ordering | ||
|
||
#### Lexicographic ordering | ||
`hello10` bigger than `hello2`. | ||
|
||
#### Pseudo-random ordering | ||
#### Lexicographic ordering | ||
|
||
#### Dot modifier | ||
For symbols in the Latin alphabet this is more or less equivalent to the encoding ordering. | ||
However, different languages have totally different customary approaches, and are not often based on alphabets. | ||
Basically any criteria rooted in linguistic arguments goes in here. |