aboutsummaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorMarshall Lochbaum <mwlochbaum@gmail.com>2020-07-23 13:01:58 -0400
committerMarshall Lochbaum <mwlochbaum@gmail.com>2020-07-23 13:01:58 -0400
commit7dd7230cdd4b725a6837a195752831594080b2a9 (patch)
treed70ff59d2d1a322f53aad32ed968fc699793cf70 /doc
parentf42eaf48b8db00eaba45a47494d7708030379190 (diff)
No need for Each to get scalar function leading axis agreement any more
Diffstat (limited to 'doc')
-rw-r--r--doc/leading.md4
1 files changed, 2 insertions, 2 deletions
diff --git a/doc/leading.md b/doc/leading.md
index 2901baea..95fde0fa 100644
--- a/doc/leading.md
+++ b/doc/leading.md
@@ -85,9 +85,9 @@ Functions with single-axis depth 1 tend to be more complicated; see for example
Scalar functions, and the Each (`¨`) and Depth (`⚇`) modifiers, use leading axis agreement to match their arguments together. All axes of the lower-rank argument are matched with the leading axes of the higher-rank one, and axes matched together must have the same length. After pairing axes in this way, a single element of the lower-rank argument might correspond to any number of elements of the higher-rank one. It's reused for each of those corresponding elements.
⊢ x ← 3‿2‿4 ⥊ ↕60 # A rank-3 array
- 100‿0‿200 +¨ x # 0-cells paired with 2-cells
+ 100‿0‿200 + x # 0-cells paired with 2-cells
⊢ c ← 100 × 3 =⌜○↕ 2 # A rank-2 array to add
- c +¨ x # 0-cells paired with 1-cells
+ c + x # 0-cells paired with 1-cells
x + x # Pairwise addition
If one argument is a scalar, that is, it has no axes, then leading axis agreement reduces to "scalar extension", where a single scalar is matched with an entire array by repeating it at every application. A scalar always agrees with any other array under leading axis agreement because it has no axes whose lengths would need to be checked.