diff options
| author | Marshall Lochbaum <mwlochbaum@gmail.com> | 2021-03-15 16:59:32 -0400 |
|---|---|---|
| committer | Marshall Lochbaum <mwlochbaum@gmail.com> | 2021-03-15 16:59:32 -0400 |
| commit | 4f618598f2f31bc466343e4d304f35b53a366da6 (patch) | |
| tree | f645f16425939a45ac82fcd0b3b477f9030bc7d9 /spec/types.md | |
| parent | e858f41dffaee272ffcf4b2cb63a49ad25ebf7d7 (diff) | |
Finish namespace specification
Diffstat (limited to 'spec/types.md')
| -rw-r--r-- | spec/types.md | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/spec/types.md b/spec/types.md index eb9b8a1f..4549fd04 100644 --- a/spec/types.md +++ b/spec/types.md @@ -2,19 +2,22 @@ # Specification: BQN types -BQN programs manipulate data of six types: +BQN programs manipulate data of seven types: - Character - Number - Array - Function - 1-Modifier - 2-Modifier +- Namespace -Of these, the first three are considered *data types* and the remaining three *operation types*. We first describe the operation types; the remainder of this page will be dedicated to the data types. A member of any operation type accepts some number of *inputs* and either returns a *result* or causes an error; inputs and the result are values of any type. When a function is given inputs (*called*), it may produce side effects before returning, such as manipulating variables and calling other functions within its scope, or performing I/O. +Of these, the first three are considered *data types* and the next three *operation types*. We first describe the operation types and the namespace; the remainder of this page will be dedicated to the data types. A member of any operation type accepts some number of *inputs* and either returns a *result* or causes an error; inputs and the result are values of any type. When a function is given inputs (*called*), it may produce side effects before returning, such as manipulating variables and calling other functions within its scope, or performing I/O. - A *function* takes one (monadic call) or two (dyadic call) *arguments*. - A *1-modifier* takes one *operand*. - A *2-modifier* takes two *operands*. +A namespace holds the variables used to evaluate a block or program, as defined in the [scoping rules](scope.md). The observable aspects of a namespace are that it can be compared for equality with other namespaces and that it exposes variables associated with certain names, whose values can be queried or set. + To begin the data types, a *character* is a [Unicode](https://en.wikipedia.org/wiki/Unicode) code point, that is, its value is a non-negative integer within the ranges defined by Unicode (however, it is distinct from this number as a BQN value). Characters are ordered by this numeric value. BQN deals with code points as abstract entities and does not expose encodings such as UTF-8 or UTF-16. The precise type of a *number* may vary across BQN implementations or instances. A *real number* is a member of some supported subset of the [extended real numbers](https://en.wikipedia.org/wiki/Extended_real_number_line), that is, the real numbers and positive or negative infinity. Some system must be defined for rounding an arbitrary real number to a member of this subset, and the basic arithmetic operations add, subtract, multiply, divide, and natural exponent (base *e*) are defined by performing these operations on exact real values and rounding the result. The Power function (dyadic `⋆`) is also used but need not be exactly rounded. A *complex number* is a value with two real number *components*, a *real part* and an *imaginary part*. A BQN implementation can either support real numbers only, or complex numbers. |
