aboutsummaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorMarshall Lochbaum <mwlochbaum@gmail.com>2022-06-04 16:03:55 -0400
committerMarshall Lochbaum <mwlochbaum@gmail.com>2022-06-04 16:03:55 -0400
commitcd0f461eee93367459dd82a29dd148fff75e5ec6 (patch)
tree3983f1e5e58a4374baaf7abfca8e62dcdf9fc705 /doc
parentefa9759b24567bdda8f6345bd4b6e548e8a278cc (diff)
Paragraph about empty arrays
Diffstat (limited to 'doc')
-rw-r--r--doc/array.md2
1 files changed, 2 insertions, 0 deletions
diff --git a/doc/array.md b/doc/array.md
index 37efa0a0..873778c9 100644
--- a/doc/array.md
+++ b/doc/array.md
@@ -105,6 +105,8 @@ The total number of elements in an array is its **bound**, and can be found usin
Any BQN value can be used as an array element, including another array (BQN, as a dynamically-typed language, doesn't restrict the types that can be used in one context without a good reason). However, BQN arrays are restricted relative to other array models. Frameworks like NumPy or Julia have mutable arrays, so that the value of an element can be changed after the array is created. This allows an array to be its own element, by creating an array and then inserting it into itself. This would be unnatural in BQN, where an array can only be formed from elements that already exist. In BQN only operations and namespaces are [mutable](lexical.md#mutation).
+An array with no elements (a bound of 0) is called **empty**. These arrays can cause problems when a property should be computed from the elements of an array, like the sum `+´𝕩` or shape of the [merged](couple.md#merge-and-array-theory) array `>𝕩`. BQN has two mechanisms to make these cases work better. First, reductions like `+´` have [identity values](fold.md#identity-values) for certain functions, so that `+´⟨⟩` is `0` for example. Second, every array might have a [fill element](fill.md), a special "typical element" for the array. Functions like Merge use this element's structure to determine the result shape when there are no actual elements to be used.
+
## Cells
The contents of an array are its elements, but it also makes sense to split up an array into subarrays of elements called cells. The most important kind of cell, a **major cell** consists of all the elements that have indices beginning with some particular index `i`. For this to make sense, `i` must be between `0` and the length `l` of the array's first axis, so that there are `l` major cells each identified by an index.