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