on 8564483 help sign in
279 lines 3.4 kB history raw
1---
2navhome: /docs
3---
6# 2f: noun ordering
7### `++aor`
9Alphabetic order
11Computes whether `a` and `b` are in alphabetical order, producing a
12boolean.
14Accepts
15-------
17`a` is a noun.
19`b` is a noun.
21Produces
22--------
24A boolean atom.
27Source
28------
30 ++ aor :: a-order
31 ~/ %aor
32 |= {a/* b/*}
33 ^- ?
34 ?: =(a b) &
35 ?. ?=(@ a)
36 ?: ?=(@ b) |
37 ?: =(-.a -.b)
38 $(a +.a, b +.b)
39 $(a -.a, b -.b)
40 ?. ?=(@ b) &
41 |-
42 =+ [c=(end 3 1 a) d=(end 3 1 b)]
43 ?: =(c d)
44 $(a (rsh 3 1 a), b (rsh 3 1 b))
45 (lth c d)
48Examples
49--------
51 > (aor 'a' 'b')
52 %.y
53 > (aor 'b' 'a')
54 %.n
55 > (aor "foo" "bar")
56 %.n
57 > (aor "bar" "foo")
58 %.y
59 > (aor "abcdefz" "abcdefa")
60 %.n
61 > (aor "abcdefa" "abcdefz")
62 %.y
63 > (aor 10.000 17.000)
64 %.y
65 > (aor 10 9)
66 %.n
70***
71### `++dor`
73Numeric order
75Computes whether `a` and `b` are in ascending numeric order, producing a
76boolean.
78Accepts
79-------
81`a` is a noun.
83`b` is a noun.
85Produces
86--------
88A boolean atom.
90Source
91------
93 ++ dor :: d-order
94 ~/ %dor
95 |= {a/* b/*}
96 ^- ?
97 ?: =(a b) &
98 ?. ?=(@ a)
99 ?: ?=(@ b) |
100 ?: =(-.a -.b)
101 $(a +.a, b +.b)
102 $(a -.a, b -.b)
103 ?. ?=(@ b) &
104 (lth a b)
107Examples
108--------
110 > (dor 1 2)
111 %.y
112 > (dor 2 1)
113 %.n
114 > (dor ~[1 2 3] ~[1 2 4])
115 %.y
116 > (dor ~[1 2 4] ~[1 2 3])
117 %.n
118 > (dor (limo ~[99 100 10.000]) ~[99 101 10.000])
119 %.y
120 > (dor ~[99 101 10.999] (limo ~[99 100 10.000]))
121 %.n
125***
126### `++gor`
128Hash order
130XX revisit
132Accepts
133-------
135`a` is a noun.
137`b` is a noun.
139Produces
140--------
142A boolean atom.
144Source
145------
147 ++ gor :: g-order
148 ~/ %gor
149 |= {a/* b/*}
150 ^- ?
151 =+ [c=(mug a) d=(mug b)]
152 ?: =(c d)
153 (dor a b)
154 (lth c d)
157Examples
158--------
160 > (gor 'd' 'c')
161 %.y
162 > 'd'
163 'd'
164 > 'c'
165 > `@ud`'d'
166 100
167 > `@ud`'c'
168 99
169 > (mug 'd')
170 1.628.185.714
171 > (mug 'c')
172 1.712.073.811
173 > (gor 'd' 'c')
174 %.y
175 > (gor 'c' 'd')
176 %.n
177 > (gor "foo" "bar")
178 %.n
179 > (gor (some 10) (limo [1 2 3 ~]))
180 %.n
184***
185### `++hor`
187Hash order
189XX revisit
191Recursive hash comparator gate.
193Accepts
194-------
196`a` is a noun.
198`b` is a noun.
200Produces
201--------
203A boolean atom.
206Source
207------
209 ++ hor :: h-order
210 ~/ %hor
211 |= {a/* b/*}
212 ^- ?
213 ?: ?=(@ a)
214 ?. ?=(@ b) &
215 (gor a b)
216 ?: ?=(@ b) |
217 ?: =(-.a -.b)
218 (gor +.a +.b)
219 (gor -.a -.b)
220 ::
223Examples
224--------
226 > (hor . 1)
227 %.n
228 > (hor 1 2)
229 %.y
230 > (hor "abc" "cba")
231 %.y
232 > (hor 'c' 'd')
233 %.n
237***
238### `++vor`
240Double hash comparator gate.
242XX revisit
244Accepts
245-------
247`a` is a noun
249`b` is a noun
251Produces
252-------
254Source
255------
257 ++ vor :: v-order
258 ~/ %vor
259 |= {a/* b/*}
260 ^- ?
261 =+ [c=(mug (mug a)) d=(mug (mug b))]
262 ?: =(c d)
263 (dor a b)
264 (lth c d)
267Examples
268--------
270 > (vor 'f' 'g')
271 %.y
272 > (vor 'a' 'z')
273 %.n
274 > (vor 43.326 41.106)
275 %.n
279***