on d452c09 help sign in
274 lines 3.4 kB history raw
1# 2f: noun ordering
2### `++aor`
4Alphabetic order
6Computes whether `a` and `b` are in alphabetical order, producing a
7boolean.
9Accepts
10-------
12`a` is a noun.
14`b` is a noun.
16Produces
17--------
19A boolean atom.
22Source
23------
25 ++ aor :: a-order
26 ~/ %aor
27 |= {a/* b/*}
28 ^- ?
29 ?: =(a b) &
30 ?. ?=(@ a)
31 ?: ?=(@ b) |
32 ?: =(-.a -.b)
33 $(a +.a, b +.b)
34 $(a -.a, b -.b)
35 ?. ?=(@ b) &
36 |-
37 =+ [c=(end 3 1 a) d=(end 3 1 b)]
38 ?: =(c d)
39 $(a (rsh 3 1 a), b (rsh 3 1 b))
40 (lth c d)
43Examples
44--------
46 > (aor 'a' 'b')
47 %.y
48 > (aor 'b' 'a')
49 %.n
50 > (aor "foo" "bar")
51 %.n
52 > (aor "bar" "foo")
53 %.y
54 > (aor "abcdefz" "abcdefa")
55 %.n
56 > (aor "abcdefa" "abcdefz")
57 %.y
58 > (aor 10.000 17.000)
59 %.y
60 > (aor 10 9)
61 %.n
65***
66### `++dor`
68Numeric order
70Computes whether `a` and `b` are in ascending numeric order, producing a
71boolean.
73Accepts
74-------
76`a` is a noun.
78`b` is a noun.
80Produces
81--------
83A boolean atom.
85Source
86------
88 ++ dor :: d-order
89 ~/ %dor
90 |= {a/* b/*}
91 ^- ?
92 ?: =(a b) &
93 ?. ?=(@ a)
94 ?: ?=(@ b) |
95 ?: =(-.a -.b)
96 $(a +.a, b +.b)
97 $(a -.a, b -.b)
98 ?. ?=(@ b) &
99 (lth a b)
102Examples
103--------
105 > (dor 1 2)
106 %.y
107 > (dor 2 1)
108 %.n
109 > (dor ~[1 2 3] ~[1 2 4])
110 %.y
111 > (dor ~[1 2 4] ~[1 2 3])
112 %.n
113 > (dor (limo ~[99 100 10.000]) ~[99 101 10.000])
114 %.y
115 > (dor ~[99 101 10.999] (limo ~[99 100 10.000]))
116 %.n
120***
121### `++gor`
123Hash order
125XX revisit
127Accepts
128-------
130`a` is a noun.
132`b` is a noun.
134Produces
135--------
137A boolean atom.
139Source
140------
142 ++ gor :: g-order
143 ~/ %gor
144 |= {a/* b/*}
145 ^- ?
146 =+ [c=(mug a) d=(mug b)]
147 ?: =(c d)
148 (dor a b)
149 (lth c d)
152Examples
153--------
155 > (gor 'd' 'c')
156 %.y
157 > 'd'
158 'd'
159 > 'c'
160 > `@ud`'d'
161 100
162 > `@ud`'c'
163 99
164 > (mug 'd')
165 1.628.185.714
166 > (mug 'c')
167 1.712.073.811
168 > (gor 'd' 'c')
169 %.y
170 > (gor 'c' 'd')
171 %.n
172 > (gor "foo" "bar")
173 %.n
174 > (gor (some 10) (limo [1 2 3 ~]))
175 %.n
179***
180### `++hor`
182Hash order
184XX revisit
186Recursive hash comparator gate.
188Accepts
189-------
191`a` is a noun.
193`b` is a noun.
195Produces
196--------
198A boolean atom.
201Source
202------
204 ++ hor :: h-order
205 ~/ %hor
206 |= {a/* b/*}
207 ^- ?
208 ?: ?=(@ a)
209 ?. ?=(@ b) &
210 (gor a b)
211 ?: ?=(@ b) |
212 ?: =(-.a -.b)
213 (gor +.a +.b)
214 (gor -.a -.b)
215 ::
218Examples
219--------
221 > (hor . 1)
222 %.n
223 > (hor 1 2)
224 %.y
225 > (hor "abc" "cba")
226 %.y
227 > (hor 'c' 'd')
228 %.n
232***
233### `++vor`
235Double hash comparator gate.
237XX revisit
239Accepts
240-------
242`a` is a noun
244`b` is a noun
246Produces
247-------
249Source
250------
252 ++ vor :: v-order
253 ~/ %vor
254 |= {a/* b/*}
255 ^- ?
256 =+ [c=(mug (mug a)) d=(mug (mug b))]
257 ?: =(c d)
258 (dor a b)
259 (lth c d)
262Examples
263--------
265 > (vor 'f' 'g')
266 %.y
267 > (vor 'a' 'z')
268 %.n
269 > (vor 43.326 41.106)
270 %.n
274***