You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/ordering.md
+11-4Lines changed: 11 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,7 +3,7 @@ Ordering criteria are used in two situations:
3
3
- in the `order-by` attributes of cycles for each type but `for-range`
4
4
- as basic boolean binary operator in the RPN virtual machine
5
5
6
-
The two implementations are not unified, so feature parity is desired but not intrinsic.
6
+
The two implementations are not unified, so feature parity is desirable but not intrinsic.
7
7
8
8
## Order types
9
9
@@ -13,7 +13,7 @@ Whatever ordinal is assigned to the entries, sorting is just based on an ascendi
13
13
14
14
### `RANDOM`
15
15
16
-
Data of any type is first hashed, and `ASC` is applied to those hashes.
16
+
Data of any type is first hashed, and `asc` is applied to those hashes.
17
17
For integers, floats and booleans this just involves their immediate data.
18
18
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.
19
19
Nodes should not be directly compared. Doing so is not illegal, just nonsensical.
@@ -22,24 +22,28 @@ Nodes should not be directly compared. Doing so is not illegal, just nonsensical
22
22
23
23
### Nodes
24
24
25
+
Via suffix `:n` or `:node`.
25
26
Nodes should not be directly compared.
26
27
Doing so is not illegal, just nonsensical and UB.
27
28
A more precise semantic for this case might be introduced later on.
28
29
29
-
### Attributes
30
+
### ~~Attributes~~
30
31
31
-
By default, they are cast to string before evaluation.
32
+
They are always cast to string before evaluation. So they will not be compared as XML nodes.
32
33
33
34
### Integers
34
35
36
+
Via suffix `:i`, `:int` or `:integer`.
35
37
Comparison as expected from any basic math class.
36
38
37
39
### Floats
38
40
41
+
Via suffix `:f`, `:float``.
39
42
Comparison as expected from any basic math class.
40
43
41
44
### Booleans
42
45
46
+
Via suffix `:b`, `:bool` or `:boolean`.
43
47
`true` is smaller than `false`.
44
48
45
49
### Strings
@@ -48,14 +52,17 @@ Strings are by far the most complex to handle as multiple criteria are possible.
48
52
49
53
#### Encoding ordering
50
54
55
+
Via suffix `:s`, `:str` or `:string`.
51
56
Based on the binary representation of UTF-8 encoding.
52
57
53
58
#### Natural ordering
54
59
60
+
Via suffix `:ns`, `:natstr` or `:natural-string`.
55
61
`hello10` bigger than `hello2`.
56
62
57
63
#### Lexicographic ordering
58
64
65
+
Via suffix `:ls`, `:lexistr` or `:lexi-string`.
59
66
For symbols in the Latin alphabet this is more or less equivalent to the encoding ordering.
60
67
However, different languages have totally different customary approaches, and are not often based on alphabets.
61
68
Basically any criteria rooted in linguistic arguments goes in here.
0 commit comments