Main result #
Introduce main properties of Up
(well-ordered relation for "upwards" induction on ℕ
) and of
ByteArray
A terminal byte slice, a suffix of a byte array.
Instances For
The number of elements in the byte slice.
Instances For
Index into a byte slice. The getOp
function allows the use of the buf[i]
notation.
Instances For
Convert a byte array into a terminal slice.
Equations
- arr.toSliceT = { arr := arr, off := 0 }
Instances For
Convert a byte slice into an array, by copying the data if necessary.
Equations
- x.toArray = match x with | { arr := arr, off := off, len := len } => arr.extract off len
Instances For
The inner loop of the forIn
implementation for byte slices.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Convert a terminal byte slice into a regular byte slice.
Equations
Instances For
Convert a byte array into a byte slice.
Equations
- arr.toSlice = { arr := arr, off := 0, len := arr.size }
Instances For
Convert a string of assumed-ASCII characters into a byte array. (If any characters are non-ASCII they will be reduced modulo 256.)
Equations
- s.toAsciiByteArray = String.toAsciiByteArray.loop s 0 ByteArray.empty
Instances For
Equations
- String.toAsciiByteArray.loop s p out = if h : s.atEnd p = true then out else let c := s.get p; let_fun this := ⋯; String.toAsciiByteArray.loop s (s.next p) (out.push c.toUInt8)
Instances For
Convert a byte slice into a string. This does not handle non-ASCII characters correctly: every byte will become a unicode character with codepoint < 256.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- One or more equations did not get rendered due to their size.