2title = "2f: Noun Ordering"
11Computes whether `a` and `b` are in alphabetical order, producing a flag.
38 =+ [c=(end 3 1 a) d=(end 3 1 b)]
40 $(a (rsh 3 1 a), b (rsh 3 1 b))
62 > (aor "abcdefz" "abcdefa")
65 > (aor "abcdefa" "abcdefz")
81Computes whether `a` and `b` are in ascending numeric order, producing a flag.
119 > (dor ~[1 2 3] ~[1 2 4])
122 > (dor ~[1 2 4] ~[1 2 3])
125 > (dor `(list @)`~[99 100 10.000] ~[99 101 10.000])
128 > (dor ~[99 101 10.999] `(list @)`~[99 100 10.000])
134If `a` and `b` are both atoms, `dor` is equivalent to [`lte`](@/docs/hoon/reference/stdlib/1a.md). If they're
135cells, `dor` recurses on the heads, and then if the heads are the same it checks
138If one sample is a cell and the other is an atom, the cell sample is treated as
147Computes whether of `(mug a)` and `(mug b)` are in ascending numeric order,
148producing a flag. If the `mug` hashes are equal, `a` and `b` are compared by
151[`mug`](@/docs/hoon/reference/stdlib/2e.md) is the the 31-bit nonzero FNV-1a hash algorithm.
170 =+ [c=(mug a) d=(mug b)]
209 > (gor (some 10) `(list @)`[1 2 3 ~])
215`map`s use `gor` on the key for horizontal ordering and `vor` for
216vertical order. `map`s only look at the keys (the head of the key-value pair
217elements) for ordering.
224If `a` and `b` are atoms, they are computed as samples of `gor`, producing a
227If `a` and `b` are cells, `hor` checks to see if their heads are equal. If their
228heads are equal, `gor` is computed on their tails, producing a flag. If their
229heads are not equal, `gor` is computed on their heads, producing a flag.
231If `a` is an atom and `b` is not, then `%.y` is produced. If `b` is an atom and
232`a` is not, `%.n` is produced.
281 > (hor 500.000.000 "foo")
284 > (hor "foo" 500.000.000)
290 > (gor `(list @)`[0 ~] 1)
293 > (hor `(list @)`[50 500 5.000 ~] 1)
299Sets (+set, +in) use `hor` for their horizontal order and `vor` for their
300vertical order. See [`apt:in`](@/docs/hoon/reference/stdlib/2h.md) to see how a set verifies its correctness.
301`vor` is used to verify.
308Computes whether the corresponding legs of `a` and `b` are in ascending
309numeric order, producing a flag.
349 > (lor `(list @)`[1 2 3 ~] `(list @)`[1 2 3 4 ~])
352 > (lor `(list @)`[1 2 3 ~] `(list @)`[1 2 2 ~])
355 > (lor `(list @)`[1 2 3 ~] `(list @)`[2 2 ~])
358 > (lor [2 2 5] [1 5 9 8])
361 > (lor [1 5 8] [1 5 9 8])
364 > (lor [1 2 3] [1 2])
370`lor` is no longer used internally.
377Computes whether the double-hashes `(mug (mug a))` and `(mug (mug b))` are in
378ascending numeric order, producing a flag. If the double-`mug` hashes are
379equal, `a` and `b` are compared by `dor` instead.
381[`mug`](@/docs/hoon/reference/stdlib/2e.md) is the the 31-bit nonzero FNV-1a hash algorithm.
401 =+ [c=(mug (mug a)) d=(mug (mug b))]
413 > [(mug 'f') (mug 'g')]
414 [1.661.740.952 1.644.963.335]
416 > [(mug (mug 'f')) (mug (mug 'g'))]
417 [261.421.509 1.861.258.547]
422 > (vor 43.326 41.106)
428Maps, sets, and queues all use `vor` to check for vertical ordering. Maps and
429sets also use `gor` and `hor` for horizontal order, respectively, but queues use
430vertical ordering alone.
432Since hashing removes correlation, double-`mug`ging with `vor` removes
433correlation with single-`mug`ged `hor`. Vertical order becomes uncorrelated
434with horizontal order.
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list