Data: Difference between revisions

From Adam Colton
Jump to navigation Jump to search
No edit summary
No edit summary
Line 5: Line 5:
   [1]*0[10]*
   [1]*0[10]*
The number of 1's (L) indicates the data length. The length is ((1<<(L-1))+1, with an exception that L==0 is 1. I think there's a better formula, but I haven't found it yet. This has several advantages.
The number of 1's (L) indicates the data length. The length is ((1<<(L-1))+1, with an exception that L==0 is 1. I think there's a better formula, but I haven't found it yet. This has several advantages.
== Fundamental Structures ==
=== Value ===
A type and bytes where the type indicates how to interpret the bytes.
=== Array ===
An ordered list, all of the same type.
=== Tagged Union ===
One of a set of types with a tag indicating the type.
=== Tuple ===
An ordered list where the tuple type defines the length and the type of each element.
=== Struct ===
An unordered list where each element has a tag and a type.
=== Associative Array ===
An unordered list where each element has key and value.

Revision as of 15:03, 19 September 2019

Data; it's structure, formatting and storage.

Large Uint

We can treat any piece of data as a large unsigned int. The efficient encoding of a large unsigned int is to encode the length as a header:

 [1]*0[10]*

The number of 1's (L) indicates the data length. The length is ((1<<(L-1))+1, with an exception that L==0 is 1. I think there's a better formula, but I haven't found it yet. This has several advantages.

Fundamental Structures

Value

A type and bytes where the type indicates how to interpret the bytes.

Array

An ordered list, all of the same type.

Tagged Union

One of a set of types with a tag indicating the type.

Tuple

An ordered list where the tuple type defines the length and the type of each element.

Struct

An unordered list where each element has a tag and a type.

Associative Array

An unordered list where each element has key and value.