on master help sign in
Update 2f

Gave explanations for each entry

commit005ec776e011196d3a96dfaf4c7b39fdcf1a7ab4 authorrmariani <robert@tlon.io> dateWed 13 Jun 2018, 14:05 (8 years ago) parent6e48502
1 file changed+44−12
docs/hoon/library/2f.md+44−12
docs/hoon/library/2f.md+44−12
@@ -6,7 +6,7 @@ navhome: /docs/
66# 2f: noun ordering
77### `++aor`
88
9−Alphabetic order
9+Alphabetical order
1010
1111Computes whether `a` and `b` are in alphabetical order, producing a flag.
1212
@@ -123,6 +123,14 @@ A flag.
123123 > (dor ~[99 101 10.999] `(list @)`~[99 100 10.000])
124124 %.n
125125
126+#### Discussion
127+
128+If `a` and `b` are both atoms, `dor` is equivalent to [`lte`](../1a). If they're
129+cells, `dor` recurses on the heads, and then if the heads are the same it checks
130+the tails.
131+
132+If one sample is a cell and the other is an atom, the cell sample is treated as
133+"greater."
126134
127135
128136***
@@ -130,8 +138,9 @@ A flag.
130138
131139Hash order
132140
133−Computes whether the products of `a` and `b` hashed with `mug` are in
134−ascending numeric order, producing a flag.
141+Computes whether of `(mug a)` and `(mug b)` are in ascending numeric order,
142+producing a flag. If the `mug` hashes are equal, `a` and `b` are compared by
143+`dor` instead.
135144
136145[`mug`](../2e) is the the 31-bit nonzero FNV-1a hash algorithm.
137146
@@ -192,20 +201,24 @@ A flag.
192201 > (gor (some 10) `(list @)`[1 2 3 ~])
193202 %.n
194203
204+#### Discussion
195205
206+`map`s use `gor` on the key for horizontal ordering and `vor` for
207+vertical order. `map`s only look at the keys (the head of the key-value pair
208+elements) for ordering.
196209
197210***
198211### `++hor`
199212
200−Head/tail hash order
213+Horizontal hash order
214+
215+If `a` and `b` are atoms, they are computed as samples of `gor`, producing a
216+flag.
201217
202218If `a` and `b` are cells, `hor` checks to see if their heads are equal. If their
203219heads are equal, `gor` is computed on their tails, producing a flag. If their
204220heads are not equal, `gor` is computed on their heads, producing a flag.
205221
206−If `a` and `b` are atoms, they are computed as samples of `gor`, producing a
207−flag.
208−
209222If `a` is an atom and `b` is not, then `%.y` is produced. If `b` is an atom and
210223`a` is not, `%.n` is produced.
211224
@@ -270,6 +283,11 @@ A flag.
270283 %.n
271284
272285
286+#### Discussion
287+
288+Sets (+set, +in) use `hor` for their horizontal order and `vor` for their
289+vertical order. See [`apt:in`](../2h) to see how a set verifies its correctness.
290+`vor` is used to verify.
273291
274292***
275293### `++lor`
@@ -312,7 +330,7 @@ A flag.
312330 > (lor 2 1)
313331 %.n
314332
315− > (lor 9 [1 2]) :: lor computes cells as greater than atoms
333+ > (lor 9 [1 2])
316334 %.y
317335
318336 > (lor `(list @)`[1 2 3 ~] `(list @)`[1 2 3 4 ~])
@@ -327,21 +345,25 @@ A flag.
327345 > (lor [2 2 5] [1 5 9 8])
328346 %.n
329347
330− > (lor [1 4 8] [1 5 9 8])
348+ > (lor [1 5 8] [1 5 9 8])
331349 %.y
332350
333351 > (lor [1 2 3] [1 2])
334352 !! exit
335353
336354
355+#### Discussion
356+
357+`lor` is no longer used internally.
337358
338359***
339360### `++vor`
340361
341−Double hash order
362+Vertical order
342363
343−Computes whether the products of `a` and `b` double-hashed with `mug` are in
344−ascending numeric order, producing a flag.
364+Computes whether the double-hashes `(mug (mug a))` and `(mug (mug b))` are in
365+ascending numeric order, producing a flag. If the double-`mug` hashes are
366+equal, `a` and `b` are compared by `dor` instead.
345367
346368[`mug`](../2e) is the the 31-bit nonzero FNV-1a hash algorithm.
347369
@@ -386,5 +408,15 @@ A flag.
386408 %.n
387409
388410
411+#### Discussion
412+
413+Maps, sets, and queues all use `vor` to check for vertical ordering. Maps and
414+sets also use `gor` and `hor` for horizontal order, respectively, but queues use
415+vertical ordering alone.
416+
417+Since hashing removes correlation, double-`mug`ging with `vor` removes
418+correlation with single-`mug`ged `hor`. Vertical order becomes uncorrelated
419+with horizontal order.
420+
389421
390422***