aboutsummaryrefslogtreecommitdiff
path: root/doc/fill.md
diff options
context:
space:
mode:
authorMarshall Lochbaum <mwlochbaum@gmail.com>2021-08-07 20:57:51 -0400
committerMarshall Lochbaum <mwlochbaum@gmail.com>2021-08-07 20:57:51 -0400
commitc7ef3aabb54791b597d4095011ff048c2a13f6ac (patch)
tree45967d042b204df64097a57cf6c72c4b4be8d1f6 /doc/fill.md
parent7bf2aa4054b8378a76dff63acdccbcdad91f68e6 (diff)
Document use of fill elements for merge of empty
Diffstat (limited to 'doc/fill.md')
-rw-r--r--doc/fill.md4
1 files changed, 3 insertions, 1 deletions
diff --git a/doc/fill.md b/doc/fill.md
index ed93b02c..6b4bd53c 100644
--- a/doc/fill.md
+++ b/doc/fill.md
@@ -4,7 +4,7 @@
A few array operations need an array element to use when no existing element applies. BQN tries to maintain a "default" element for every array, known as a fill element, for this purpose. If it's known, the fill element is a nested array structure where each atom is either `0` or `' '`. If no fill is known, a function that requests it results in an error.
-Fills are used by [Take](take.md) (`↑`) when a value in `𝕨` is larger than the corresponding length in `𝕩`, by the two [Nudge](shift.md) functions (`»«`) when `𝕩` is non-empty, and by [Reshape](reshape.md) (`⥊`) when `𝕨` contains `↑`. Except for these specific cases, the fill value an array has can't affect the program. The result of [Match](match.md) (`≡`) doesn't depend on fills, and any attempt to compute a fill can't cause side effects.
+Fills are used by [Take](take.md) (`↑`) when a value in `𝕨` is larger than the corresponding length in `𝕩`, by the two [Nudge](shift.md) functions (`»«`) when `𝕩` is non-empty, by [Merge](couple.md) (`>`) when `𝕩` is empty, and by [Reshape](reshape.md) (`⥊`) when `𝕨` contains `↑`. Except for these specific cases, the fill value an array has can't affect the program. The result of [Match](match.md) (`≡`) doesn't depend on fills, and any attempt to compute a fill can't cause side effects.
## Using fills
@@ -24,6 +24,8 @@ Nudge Left or Right shifts the array over and places a fill in the vacated space
»⟨⟩ # Fill not needed
+If the argument to [Merge](couple.md) is empty then its result will be as well, since the shape `≢𝕩` is a prefix of `≢>𝕩`. However, the remainder of the result shape is determined by the elements of `𝕩`, so if there are none then Merge uses the fill element to decide what the result shape should be.
+
[Reshape](reshape.md#computed-lengths) (`⥊`) uses the fill when `𝕨` contains `↑` and the product of the rest of `𝕨` doesn't evenly divide the number of elements in `𝕩`.
↑‿8 ⥊ "completepart"