on master help sign in
Update 2f

Added `++lor` entry, added descriptions on other entries where they were missing, added syntax

commit6e4850227f236fcdae81955c25c9dd20d00e04d7 authorrmariani <robert@tlon.io> dateMon 4 Jun 2018, 15:24 (8 years ago) parente70ba7a
1 file changed+183−72
docs/hoon/library/2f.md+183−72
docs/hoon/library/2f.md+183−72
@@ -8,28 +8,23 @@ navhome: /docs/
88
99Alphabetic order
1010
11−Computes whether `a` and `b` are in alphabetical order, producing a
12−boolean.
11+Computes whether `a` and `b` are in alphabetical order, producing a flag.
1312
14−Accepts
15−-------
13+#### Accepts
1614
1715`a` is a noun.
1816
1917`b` is a noun.
2018
21−Produces
22−--------
19+#### Produces
2320
24−A boolean atom.
21+A flag.
2522
23+#### Source
2624
27−Source
28−------
29−
30− ++ aor :: a-order
25+ ++ aor
3126 ~/ %aor
32− |= {a/* b/*}
27+ |= [a=* b=*]
3328 ^- ?
3429 ?: =(a b) &
3530 ?. ?=(@ a)
@@ -44,24 +39,32 @@ Source
4439 $(a (rsh 3 1 a), b (rsh 3 1 b))
4540 (lth c d)
4641
47−
48−Examples
49−--------
42+#### Examples
5043
5144 > (aor 'a' 'b')
5245 %.y
46+
5347 > (aor 'b' 'a')
5448 %.n
49+
50+ > (aor 'a' 'a')
51+ %.y
52+
5553 > (aor "foo" "bar")
5654 %.n
55+
5756 > (aor "bar" "foo")
5857 %.y
58+
5959 > (aor "abcdefz" "abcdefa")
6060 %.n
61+
6162 > (aor "abcdefa" "abcdefz")
6263 %.y
64+
6365 > (aor 10.000 17.000)
6466 %.y
67+
6568 > (aor 10 9)
6669 %.n
6770
@@ -72,27 +75,23 @@ Examples
7275
7376Numeric order
7477
75−Computes whether `a` and `b` are in ascending numeric order, producing a
76−boolean.
78+Computes whether `a` and `b` are in ascending numeric order, producing a flag.
7779
78−Accepts
79−-------
80+#### Accepts
8081
8182`a` is a noun.
8283
8384`b` is a noun.
8485
85−Produces
86−--------
86+#### Produces
8787
88−A boolean atom.
88+A flag.
8989
90−Source
91−------
90+#### Source
9291
93− ++ dor :: d-order
92+ ++ dor
9493 ~/ %dor
95− |= {a/* b/*}
94+ |= [a=* b=*]
9695 ^- ?
9796 ?: =(a b) &
9897 ?. ?=(@ a)
@@ -104,20 +103,24 @@ Source
104103 (lth a b)
105104
106105
107−Examples
108−--------
106+#### Examples
109107
110108 > (dor 1 2)
111109 %.y
110+
112111 > (dor 2 1)
113112 %.n
113+
114114 > (dor ~[1 2 3] ~[1 2 4])
115115 %.y
116+
116117 > (dor ~[1 2 4] ~[1 2 3])
117118 %.n
118− > (dor (limo ~[99 100 10.000]) ~[99 101 10.000])
119+
120+ > (dor `(list @)`~[99 100 10.000] ~[99 101 10.000])
119121 %.y
120− > (dor ~[99 101 10.999] (limo ~[99 100 10.000]))
122+
123+ > (dor ~[99 101 10.999] `(list @)`~[99 100 10.000])
121124 %.n
122125
123126
@@ -127,26 +130,26 @@ Examples
127130
128131Hash order
129132
130−XX revisit
133+Computes whether the products of `a` and `b` hashed with `mug` are in
134+ascending numeric order, producing a flag.
135+
136+[`mug`](../2e) is the the 31-bit nonzero FNV-1a hash algorithm.
131137
132−Accepts
133−-------
138+#### Accepts
134139
135140`a` is a noun.
136141
137142`b` is a noun.
138143
139−Produces
140−--------
144+#### Produces
141145
142−A boolean atom.
146+A flag.
143147
144−Source
145−------
148+#### Source
146149
147− ++ gor :: g-order
150+ ++ gor
148151 ~/ %gor
149− |= {a/* b/*}
152+ |= [a=* b=*]
150153 ^- ?
151154 =+ [c=(mug a) d=(mug b)]
152155 ?: =(c d)
@@ -154,29 +157,39 @@ Source
154157 (lth c d)
155158
156159
157−Examples
158−--------
160+#### Examples
159161
160162 > (gor 'd' 'c')
161163 %.y
164+
162165 > 'd'
163166 'd'
167+
164168 > 'c'
169+ 'c'
170+
165171 > `@ud`'d'
166172 100
173+
167174 > `@ud`'c'
168175 99
169− > (mug 'd')
176+
177+ > (mug 'd')
170178 1.628.185.714
179+
171180 > (mug 'c')
172181 1.712.073.811
182+
173183 > (gor 'd' 'c')
174184 %.y
185+
175186 > (gor 'c' 'd')
176187 %.n
188+
177189 > (gor "foo" "bar")
178190 %.n
179− > (gor (some 10) (limo [1 2 3 ~]))
191+
192+ > (gor (some 10) `(list @)`[1 2 3 ~])
180193 %.n
181194
182195
@@ -184,31 +197,33 @@ Examples
184197***
185198### `++hor`
186199
187−Hash order
200+Head/tail hash order
201+
202+If `a` and `b` are cells, `hor` checks to see if their heads are equal. If their
203+heads are equal, `gor` is computed on their tails, producing a flag. If their
204+heads are not equal, `gor` is computed on their heads, producing a flag.
188205
189−XX revisit
206+If `a` and `b` are atoms, they are computed as samples of `gor`, producing a
207+flag.
190208
191−Recursive hash comparator gate.
209+If `a` is an atom and `b` is not, then `%.y` is produced. If `b` is an atom and
210+`a` is not, `%.n` is produced.
192211
193−Accepts
194−-------
212+#### Accepts
195213
196214`a` is a noun.
197215
198216`b` is a noun.
199217
200−Produces
201−--------
218+#### Produces
202219
203−A boolean atom.
220+A flag.
204221
222+#### Source
205223
206−Source
207−------
208−
209− ++ hor :: h-order
224+ ++ hor
210225 ~/ %hor
211− |= {a/* b/*}
226+ |= [a=* b=*]
212227 ^- ?
213228 ?: ?=(@ a)
214229 ?. ?=(@ b) &
@@ -217,46 +232,135 @@ Source
217232 ?: =(-.a -.b)
218233 (gor +.a +.b)
219234 (gor -.a -.b)
220− ::
221235
222236
223−Examples
224−--------
237+#### Examples
225238
226239 > (hor . 1)
227240 %.n
241+
228242 > (hor 1 2)
229243 %.y
244+
230245 > (hor "abc" "cba")
231246 %.y
247+
232248 > (hor 'c' 'd')
233249 %.n
234250
251+ > (hor 100 [1 1])
252+ %.y
253+
254+ > (hor [1 1] 100)
255+ %.n
256+
257+ > (hor 500.000.000 "foo")
258+ %.y
259+
260+ > (hor "foo" 500.000.000)
261+ %.n
262+
263+ > (hor 0 "foo")
264+ %.y
265+
266+ > (gor `(list @)`[0 ~] 1)
267+ %.n
268+
269+ > (hor `(list @)`[50 500 5.000 ~] 1)
270+ %.n
271+
272+
273+
274+***
275+### `++lor`
276+
277+Leg order
278+
279+Computes whether the corresponding legs of `a` and `b` are in ascending
280+numeric order, producing a flag.
281+
282+#### Accepts
283+
284+`a` is a noun.
285+
286+`b` is a noun.
287+
288+#### Accepts
289+
290+A flag.
291+
292+#### Source
293+
294+ ++ lor
295+ ~/ %lor
296+ |= [a=* b=*]
297+ ^- ?
298+ ?: =(a b) &
299+ ?@ a
300+ ?^ b &
301+ (lth a b)
302+ ?: =(-.a -.b)
303+ $(a +.a, b +.b)
304+ $(a -.a, b -.b)
305+
306+
307+#### Examples
308+
309+ > (lor 1 2)
310+ %.y
311+
312+ > (lor 2 1)
313+ %.n
314+
315+ > (lor 9 [1 2]) :: lor computes cells as greater than atoms
316+ %.y
317+
318+ > (lor `(list @)`[1 2 3 ~] `(list @)`[1 2 3 4 ~])
319+ %.y
320+
321+ > (lor `(list @)`[1 2 3 ~] `(list @)`[1 2 2 ~])
322+ %.n
323+
324+ > (lor `(list @)`[1 2 3 ~] `(list @)`[2 2 ~])
325+ %.y
326+
327+ > (lor [2 2 5] [1 5 9 8])
328+ %.n
329+
330+ > (lor [1 4 8] [1 5 9 8])
331+ %.y
332+
333+ > (lor [1 2 3] [1 2])
334+ !! exit
335+
235336
236337
237338***
238339### `++vor`
239340
240−Double hash comparator gate.
341+Double hash order
342+
343+Computes whether the products of `a` and `b` double-hashed with `mug` are in
344+ascending numeric order, producing a flag.
345+
346+[`mug`](../2e) is the the 31-bit nonzero FNV-1a hash algorithm.
241347
242−XX revisit
243348
244−Accepts
245−-------
349+#### Accepts
246350
247351`a` is a noun
248352
249353`b` is a noun
250354
251−Produces
252−-------
355+#### Produces
253356
254−Source
255−------
357+A flag.
256358
257− ++ vor :: v-order
359+#### Source
360+
361+ ++ vor
258362 ~/ %vor
259− |= {a/* b/*}
363+ |= [a=* b=*]
260364 ^- ?
261365 =+ [c=(mug (mug a)) d=(mug (mug b))]
262366 ?: =(c d)
@@ -264,13 +368,20 @@ Source
264368 (lth c d)
265369
266370
267−Examples
268−--------
371+#### Examples
269372
270373 > (vor 'f' 'g')
271374 %.y
375+
376+ > [(mug 'f') (mug 'g')]
377+ [1.661.740.952 1.644.963.335]
378+
379+ > [(mug (mug 'f')) (mug (mug 'g'))]
380+ [261.421.509 1.861.258.547]
381+
272382 > (vor 'a' 'z')
273383 %.n
384+
274385 > (vor 43.326 41.106)
275386 %.n
276387