aboutsummaryrefslogtreecommitdiff
path: root/spec/primitive.md
diff options
context:
space:
mode:
authorMarshall Lochbaum <mwlochbaum@gmail.com>2022-04-16 17:46:04 -0400
committerMarshall Lochbaum <mwlochbaum@gmail.com>2022-04-16 17:46:04 -0400
commit5ed42f60312b87a1c85f701ed21d9d07181171e1 (patch)
tree96f6d9612d1ff085553b69605090d495b415425d /spec/primitive.md
parent7de47f9a7db71a179ba3124d39cc2c5be2000fd4 (diff)
Merge and Join with empty no-fill argument return it unchanged
Diffstat (limited to 'spec/primitive.md')
-rw-r--r--spec/primitive.md4
1 files changed, 2 insertions, 2 deletions
diff --git a/spec/primitive.md b/spec/primitive.md
index 6eef5377..8f40fa85 100644
--- a/spec/primitive.md
+++ b/spec/primitive.md
@@ -145,9 +145,9 @@ A left argument for any of the three reduction-based modifiers indicates an init
**Enclose** (`<`) forms a unit array that contains its argument. **Enlist** and **Pair** (`ā‹ˆ`) form a 1- or 2-element list of all arguments, that is, `āŸØš•©āŸ©` or `āŸØš•Ø,š•©āŸ©`.
-**Merge** (`>`) combines the outer axes of an array of arrays with inner axes: it requires that all elements of its argument have the same shape, and creates an array such that `(i∾j)āŠ‘>š•©` is `iāŠ‘jāŠ‘š•©`. It also accepts atom elements of `š•©`, converting them to unit arrays, or an atom argument, which is returned unchanged. **Solo** and **Couple** (`ā‰`) turn one or two arguments into major cells of the result and can be defined easily in terms of Merge.
+**Merge** (`>`) combines the outer axes of an array of arrays with inner axes: it requires that all elements of its argument have the same shape, and creates an array such that `(i∾j)āŠ‘>š•©` is `iāŠ‘jāŠ‘š•©`. For empty arrays the element shape is the fill shape, or `⟨⟩` if there's no fill. Merge also accepts atom elements of `š•©`, converting them to unit arrays, or an atom argument, which is returned unchanged. **Solo** and **Couple** (`ā‰`) turn one or two arguments into major cells of the result and can be defined easily in terms of Merge.
-**Join To** (`∾`) combines its two arguments along an existing initial axis, unless both arguments are units, in which case it creates an axis and is identical to Couple (`ā‰`). The arguments must differ in rank by at most 1, and the result rank is equal to the maximum of 1 and the higher argument rank. Each argument with rank less than the result, and each major cell of an argument with rank equal to it, becomes a major cell of the result, with cells from the left argument placed before those from the right. **Join** (`∾`) generalizes this behavior to an array of values instead of just two. The argument must be an array (unlike Merge), and atom elements are treated as unit arrays. "Outer" argument axes are matched up with leading "inner" element axes, and elements are joined along these axes. In order to allow this, the length of an element along a particular axis must depend only on the position along the corresponding axis in the argument. However, the axis may also be omitted, resulting in an uneven rank among arguments of `š•©`. At least one position must have the axis, so that whether a given element has it can be found by comparing it to others along that axis. Along an axis, ranks can differ by at most one because each element either has or omits that axis. If the argument to Join is empty, the result is an empty array with shape computed based on an array of fill elements: the fill rank must be greater than the rank of `š•©`, and the result shape is computed by multiplying leading lengths of the fill shape by `ā‰¢š•©`, with the trailing shape unchanged.
+**Join To** (`∾`) combines its two arguments along an existing initial axis, unless both arguments are units, in which case it creates an axis and is identical to Couple (`ā‰`). The arguments must differ in rank by at most 1, and the result rank is equal to the maximum of 1 and the higher argument rank. Each argument with rank less than the result, and each major cell of an argument with rank equal to it, becomes a major cell of the result, with cells from the left argument placed before those from the right. **Join** (`∾`) generalizes this behavior to an array of values instead of just two. The argument must be an array (unlike Merge), and atom elements are treated as unit arrays. "Outer" argument axes are matched up with leading "inner" element axes, and elements are joined along these axes. In order to allow this, the length of an element along a particular axis must depend only on the position along the corresponding axis in the argument. However, the axis may also be omitted, resulting in an uneven rank among arguments of `š•©`. At least one position must have the axis, so that whether a given element has it can be found by comparing it to others along that axis. Along an axis, ranks can differ by at most one because each element either has or omits that axis. If the argument to Join is empty, the result is an empty array with shape computed based on an array of fill elements: the fill rank must be greater than the rank of `š•©`, and the result shape is computed by multiplying leading lengths of the fill shape by `ā‰¢š•©`, with the trailing shape unchanged. If `š•©` has no fill then a fill rank equal to `=š•©` is assumed and the result is `š•©`.
**Deshape** (`ℊ`) differs from the provided function (which returns the element list of an array) only in that it accepts an atom, returning a one-element list containing it. **Reshape** (`ℊ`) is extended in numerous ways. It accepts any list of natural numbers (including as a unit array or atom) for the left argument and any right argument; `š•©` is deshaped first so that it is treated as a list of elements. These elements are repeated cyclically to fill the result array in ravel order. If `š•©` is empty then a non-empty requested result shape causes an error. Furthermore, at most one element of `š•Ø` can be a "length code": one of the primitives `āˆ˜āŒŠāŒ½ā†‘`. In this case, a target length is computed from the number of elements in `š•©` divided by the product of the other elements of `š•Ø` (which must not be zero). If the target length is an integer then it is used directly for the length code. Otherwise, an error is given if the length code is `∘`, and the target length is rounded down if the code is `⌊` and up if it's `⌽` or `↑`. With code `⌽`, elements are repeated cyclically as usual, but with code `↑`, the extra elements after each argument element is used are fill values for `š•©`.