The cheatsheet is better as a single block
This commit is contained in:
parent
9668bcbb03
commit
6e0592256d
|
@ -10,8 +10,6 @@ June 2022. Version 0.7.0.
|
||||||
|
|
||||||
For a value `v`, we write `«v»` for the binary encoding of `v`.
|
For a value `v`, we write `«v»` for the binary encoding of `v`.
|
||||||
|
|
||||||
### Atoms
|
|
||||||
|
|
||||||
«#f» = [0xA0]
|
«#f» = [0xA0]
|
||||||
«#t» = [0xA1]
|
«#t» = [0xA1]
|
||||||
«F» = [0xA2] ++ binary32(F) if F ∈ Float
|
«F» = [0xA2] ++ binary32(F) if F ∈ Float
|
||||||
|
@ -21,16 +19,6 @@ For a value `v`, we write `«v»` for the binary encoding of `v`.
|
||||||
[0xA5] ++ S if S ∈ ByteString
|
[0xA5] ++ S if S ∈ ByteString
|
||||||
[0xA6] ++ utf8(S) if S ∈ Symbol
|
[0xA6] ++ utf8(S) if S ∈ Symbol
|
||||||
|
|
||||||
The functions `binary32(F)` and `binary64(D)` yield big-endian 4- and
|
|
||||||
8-byte IEEE 754 binary representations of `F` and `D`, respectively.
|
|
||||||
|
|
||||||
The function `intbytes(x)` gives the big-endian two's-complement signed
|
|
||||||
binary representation of `x`, taking exactly as many whole bytes as
|
|
||||||
needed to unambiguously identify the value and its sign. `intbytes(0)`
|
|
||||||
is the empty byte sequence.
|
|
||||||
|
|
||||||
### Compounds
|
|
||||||
|
|
||||||
«<L F_1...F_m>» = [0xA7] ++ seq(«L», «F_1», ..., «F_m»)
|
«<L F_1...F_m>» = [0xA7] ++ seq(«L», «F_1», ..., «F_m»)
|
||||||
«[X_1...X_m]» = [0xA8] ++ seq(«X_1», ..., «X_m»)
|
«[X_1...X_m]» = [0xA8] ++ seq(«X_1», ..., «X_m»)
|
||||||
«#{E_1...E_m}» = [0xA9] ++ seq(«E_1», ..., «E_m»)
|
«#{E_1...E_m}» = [0xA9] ++ seq(«E_1», ..., «E_m»)
|
||||||
|
@ -43,14 +31,18 @@ is the empty byte sequence.
|
||||||
e(v, d) = [v + d] if v < 128
|
e(v, d) = [v + d] if v < 128
|
||||||
e(v / 128, 0) ++ [(v % 128) + d] if v ≥ 128
|
e(v / 128, 0) ++ [(v % 128) + d] if v ≥ 128
|
||||||
|
|
||||||
### Embeddeds
|
|
||||||
|
|
||||||
«#!V» = [0xBF] ++ «V»
|
«#!V» = [0xBF] ++ «V»
|
||||||
|
|
||||||
### Annotations
|
The functions `binary32(F)` and `binary64(D)` yield big-endian 4- and
|
||||||
|
8-byte IEEE 754 binary representations of `F` and `D`, respectively.
|
||||||
|
|
||||||
To annotate a `Repr` `r` (that *MUST NOT* itself already be annotated)
|
The function `intbytes(x)` gives the big-endian two's-complement signed
|
||||||
with some sequence of `Value`s `[v_1, ..., v_m]`, surround `r` as
|
binary representation of `x`, taking exactly as many whole bytes as
|
||||||
follows:
|
needed to unambiguously identify the value and its sign. `intbytes(0)`
|
||||||
|
is the empty byte sequence.
|
||||||
|
|
||||||
|
**Annotations.** To annotate a `Repr` `r` (that *MUST NOT* itself
|
||||||
|
already be annotated) with some sequence of `Value`s `[v_1, ..., v_m]`,
|
||||||
|
surround `r` as follows:
|
||||||
|
|
||||||
[0xBE] ++ len(|r|) ++ r ++ len(|«v_1»|) ++ «v_1» ++...++ len(|«v_m»|) ++ «v_m»
|
[0xBE] ++ len(|r|) ++ r ++ len(|«v_1»|) ++ «v_1» ++...++ len(|«v_m»|) ++ «v_m»
|
||||||
|
|
Loading…
Reference in New Issue