aboutsummaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
Diffstat (limited to 'doc')
-rw-r--r--doc/embed.md2
-rw-r--r--doc/glossary.md3
-rw-r--r--doc/match.md6
3 files changed, 6 insertions, 5 deletions
diff --git a/doc/embed.md b/doc/embed.md
index 1455d3cb..32f14536 100644
--- a/doc/embed.md
+++ b/doc/embed.md
@@ -42,7 +42,7 @@ You can also use an array to pass multiple functions or other values from JS int
## JS encodings
-In the programs above we've used numbers and functions of one argument, which mean the same thing in BQN and JS. This isn't the case for all types: although every BQN value is stored as some JS value, the way it's represented may not be obvious and there are many JS values that don't represent any BQN value and could cause errors. BQN operations don't verify that their inputs are valid BQN values (this would have a large performance cost), so it's up to the JS programmer to make sure that values passed in are valid. To do this, you need to know the encodings for each of the six BQN [types](types.md).
+In the programs above we've used numbers and functions of one argument, which mean the same thing in BQN and JS. This isn't the case for all types: although every BQN value is stored as some JS value, the way it's represented may not be obvious and there are many JS values that don't represent any BQN value and could cause errors. BQN operations don't verify that their inputs are valid BQN values (this would have a large performance cost), so it's up to the JS programmer to make sure that values passed in are valid. To do this, you need to know the encodings for each of the seven BQN [types](types.md) you're going to use.
The two atomic data values are simple: numbers are just JS numbers, and characters are strings containing a single code point. Arrays *are* JS arrays, but with some extra information. Since JS arrays are 1-dimensional, a BQN array `a` is stored as the element list `⥊a`. Its shape `≢a`, a list of numbers, is `a.sh` in JS (the shape isn't necessarily a BQN array so it doesn't have to have a `sh` property). Optionally, its fill element is `a.fill`. Note that a BQN string is not a JS string, but instead an array of BQN characters, or JS strings. To convert it to a JS string you can use `str.join("")`.
diff --git a/doc/glossary.md b/doc/glossary.md
index eba5e8c3..d16f5584 100644
--- a/doc/glossary.md
+++ b/doc/glossary.md
@@ -7,7 +7,7 @@ Below are short, and sometimes vague, definitions of terms used to describe BQN
## Types
* **Value**: Something that can be stored in variables and manipulated by a BQN programmer.
-* [**Type**](types.md): One of six possible kinds of value.
+* [**Type**](types.md): One of seven possible kinds of value.
The possible types are:
* [**Number**](types.md#numbers): Like some caveman was counting but then forty thousand years of math happened to it.
@@ -16,6 +16,7 @@ The possible types are:
* [**Function**](types.md#functions): An operation that is called on one or two arguments.
* [**1-modifier**](types.md#modifiers): An operation that is called on one operand.
* [**2-modifier**](types.md#modifiers): An operation that is called on two operands.
+* [**Namespace**](namespace.md): A container for variables, some of which are exposed as fields.
A few terms refer to multiple types collectively:
* **Atom**: A value that's not an array.
diff --git a/doc/match.md b/doc/match.md
index 72bd3546..96b5c4c9 100644
--- a/doc/match.md
+++ b/doc/match.md
@@ -21,7 +21,7 @@ To give a precise definition, two arrays are considered to match if they have th
## Atomic equality
-Atoms in BQN have five possible [types](types.md): number, character, function, 1-modifier, and 2-modifier. Equality is not allowed to fail for any two arguments, so it needs to be defined on all of these types.
+Atoms in BQN have six possible [types](types.md): number, character, function, 1-modifier, 2-modifier, and namespace. Equality is not allowed to fail for any two arguments, so it needs to be defined on all of these types.
Starting with the easiest rules, values with different types are never equal to each other.
@@ -32,10 +32,10 @@ Two characters are equal when they have the same code point. Numeric equality de
'x' = "wxyz"
1.25 = 1 + 0.25
-Operations are more difficult. Here there are three cases:
+Mutable types are more difficult. Here there are three cases:
- Primitives are equal if they have the same glyph.
- Compound functions or modifiers are split into components.
-- Block instances are equal if they are the same instance.
+- Block instances or namespaces are equal if they are the same instance.
The first two are fairly similar to how numbers and arrays work. Primitives and compounds like trains, or modifiers with bound operands, are immutable, so they are defined purely by what components they contain.