2title = "2f: Noun Ordering"
11Computes whether `a` and `b` are in alphabetical order, producing a flag. Orders atoms before cells, and atoms in ascending LSB order.
38 =+ [c=(end 3 a) d=(end 3 b)]
40 $(a (rsh 3 a), b (rsh 3 b))
64> (aor ['a' ~] ['b' ~])
66> (aor ['b' ~] ['a' ~])
85Note the possible differences with `+dor` due to comparing one byte at a time:
88> (aor 0b1001.0000.0000 0b1000.1000.0000)
90> (dor 0b1001.0000.0000 0b1000.1000.0000)
96This is different than [+dor](#dor) in that it compares atoms one byte at a time, while `+dor` compares whole atoms at once. Note that because it simply compares bytes, it doesn't account for multi-byte UTF-8 characters and the like.
104Computes whether `a` and `b` are in ascending tree depth order, producing a flag. Orders atoms before cells, and atoms in ascending numerical order.
142> (dor ~[1 2 3] ~[1 2 4])
145> (dor ~[1 2 4] ~[1 2 3])
148> (dor `(list @)`~[99 100 10.000] ~[99 101 10.000])
151> (dor ~[99 101 10.999] `(list @)`~[99 100 10.000])
155Note the possible difference with [+aor](#aor) due to comparing whole atoms rather than one byte at a time:
158> (aor 0b1001.0000.0000 0b1000.1000.0000)
160> (dor 0b1001.0000.0000 0b1000.1000.0000)
166If `a` and `b` are both atoms, `dor` is equivalent to [`lte`](/docs/hoon/reference/stdlib/1a#lte). If they're
167cells, `dor` recurses on the heads, and then if the heads are the same it checks
170If one sample is a cell and the other is an atom, the cell sample is treated as
179Computes whether of `(mug a)` and `(mug b)` are in ascending numeric order,
180producing a flag. If the `mug` hashes are equal, `a` and `b` are compared by
183[`mug`](/docs/hoon/reference/stdlib/2e#mug) is the the 31-bit nonzero FNV-1a hash algorithm.
202 =+ [c=(mug a) d=(mug b)]
241> (gor (some 10) `(list @)`[1 2 3 ~])
247`map`s use `gor` on the key for horizontal ordering and `mor` for
248vertical order. `map`s only look at the keys (the head of the key-value pair
249elements) for ordering.
257Computes whether the double-hashes `(mug (mug a))` and `(mug (mug b))` are in
258ascending numeric order, producing a flag. If the double-`mug` hashes are
259equal, `a` and `b` are compared by `dor` instead.
261[`mug`](/docs/hoon/reference/stdlib/2e#mug) is the the 31-bit nonzero FNV-1a hash algorithm.
280 =+ [c=(mug (mug a)) d=(mug (mug b))]
292 > [(mug 'f') (mug 'g')]
293 [1.661.740.952 1.644.963.335]
295 > [(mug (mug 'f')) (mug (mug 'g'))]
296 [261.421.509 1.861.258.547]
301 > (mor 43.326 41.106)
307Maps, sets, and queues all use `mor` to check for vertical ordering. Maps and
308sets also use `gor` for horizontal order, but queues use
309vertical ordering alone.
311Since hashing removes correlation, double-`mug`ging with `mor` removes
312correlation with single-`mug`ged `gor`. Vertical order becomes uncorrelated
313with 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