9A value in Hoon is called a `noun`. A noun is either a unsigned
10integer of any size (`atom`), or an ordered pair of any two
11nouns (`cell`). In other words, a noun is a binary tree whose
12leaves are unsigned integers.
14Nouns are a Nock concept; there is no Nock syntax; so there is no
15general noun syntax. But nouns are usually written with square
16brackets associating right; `[a b c]` means `[a [b c]]`. In Hoon
17we also see `{a b c}`, a constructor (`mold`) for `[a b c]`.
19Nouns are almost like Lisp's S-expressions, but S-expressions
20have dynamic type tags in atoms; the difference between a symbol
21and an integer, for instance, is dynamic type. Lisp needs this
22dynamic type because it doesn't expect a static type system.
24For the same reason, nouns tend to be tuple-centric where Lisp is
25list-centric. Lisp `(a b c)` as a noun is `[a b c 0]`; Nock `[a
26b c]` is Lisp `(a . b . c)`.
28Nouns are immutable and acyclic. A naive implementation uses
29reference counting and needs no tracing GC. There is no test for
30pointer equality as in Lisp. But indirect nouns have a lazily
31computed short hash, so nonduplicates have O(1) comparison cost.
33All kinds of atomic values can be and are stored as atoms:
34unsigned integers, signed integers (with sign bit low), dates,
35floats, UTF-8 strings (LSB first), even whole files. Again,
36a static type system is essential; an atom is not usable or even
37printable if we don't know what it means.
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