Merge pull request #465 from urbit/i/463/term-knot-ascii-clarify

clarify term/knot are not ASCII in general
This commit is contained in:
tinnus-napbus 2023-08-24 22:45:11 +12:00 committed by GitHub
commit 189797a48b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 10 deletions

View File

@ -14,8 +14,8 @@ We've incidentally used `'messages written as cords'` and `"as tapes"`, but asid
There are four basic ways to represent text in Urbit:
- `@t`, a `cord`, which is an atom (single value)
- `@ta`, a `knot` or ASCII text, which is an atom (single value)
- `@tas`, a `term` or ASCII text symbol
- `@ta`, a `knot` used for URL-safe path elements, which is an atom (single value)
- `@tas`, a `term` used primarily for constants, which is an atom (single value)
- `tape`, which is a `(list @t)`
This is more ways than many languages support: most languages simply store text directly as a character array, or list of characters in memory. Colloquially, we would only call cords and tapes [_strings_](https://en.wikipedia.org/wiki/String_%28computer_science%29), however.
@ -75,7 +75,7 @@ There are some tools to work with atom `cord`s of text, but most of the time it
We've hinted a bit at the structure of `list`s before; for now the main thing you need to know is that they are cells which end in a `~` sig. So rather than have all of the text values stored sequentially in a single atom, they are stored sequentially in a rightwards-branching binary tree of cells.
A tape is a list of `@tD` atoms (i.e., ASCII characters). (The upper-case character at the end of the aura hints that the `@t` values are D→3 so 2³=8 bits wide.)
A tape is a list of `@tD` atoms (i.e., characters). (The upper-case character at the end of the aura hints that the `@t` values are D→3 so 2³=8 bits wide.)
```hoon
> "this is a tape"

View File

@ -38,8 +38,8 @@ Aura Meaning Example Literal Syntax
@sw signed base64 --0wbnC.8haTg
@sx signed hexadecimal -0x5f5.e138
@t UTF-8 text (cord) 'howdy'
@ta ASCII text (knot) ~.howdy
@tas ASCII text symbol (term) %howdy
@ta URL-safe path element text (knot) ~.howdy
@tas short name text (term) %howdy
@u unsigned integer
@ub unsigned binary 0b11.1000
@ud unsigned decimal 1.000.056
@ -55,7 +55,7 @@ two, starting from A.
```
@udD unsigned single-byte (8-bit) decimal
@tD 8-bit ASCII text
@tD 8-bit UTF-8 text
@rhE half-precision (16-bit) floating-point number
@uxG unsigned 64-bit hexadecimal
@uvJ unsigned, 512-bit integer (frequently used for entropy)

View File

@ -51,8 +51,8 @@ usage = "stdlib"
slug = "#flag"
desc = "Used in the Hoon standard library."
[glossaryEntry."Atom type of ASCII characters"]
name = "Atom type of ASCII characters"
[glossaryEntry."Atom type for URL-safe path element text"]
name = "Atom type for URL-safe path element text"
symbol = "knot"
usage = "stdlib"
slug = "#knot"
@ -346,9 +346,10 @@ See also: [`year`](/reference/hoon/stdlib/3c#year), [`yore`](/reference/hoon/std
## `+$knot`
ASCII text
URL-safe path element text
An atom type that only permits ASCII characters.
An atom type that only permits lower-case letters, numbers, and four
special characters: hyphen, tilde, underscore and period.
#### Source