From df8708f11955d5e8e52798778a72521390bee728 Mon Sep 17 00:00:00 2001 From: Marshall Lochbaum Date: Mon, 4 Nov 2024 07:02:29 -0500 Subject: [PATCH] Fix several errors when discussing rank and shape of major cell search --- doc/search.md | 2 +- docs/doc/search.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/search.md b/doc/search.md index e1e1d8eb..acbf6eb7 100644 --- a/doc/search.md +++ b/doc/search.md @@ -159,7 +159,7 @@ The searched-in argument is treated as a list of its [major cells](array.md#cell rows ⊐ [["row","row","col"],["rho","cow","col"]] -So the result rank of `⊐` is always `𝕨¬○=𝕩`, with a result shape `(1-˜=𝕨)↓≒𝕩`, and `π•¨βŠπ•©` fails if `1>=𝕩` or the result rank would be negative. In the list case, we have `1==𝕩` (so the first condition holds), and the result rank resolves to `=𝕨` (which can't be negative, so the second holds as well). The cell rank of `𝕩` is 0, and the fact that a 0-cell of `𝕩` gives a 0-cell of the result is what causes the shape arithmetic to be so simple. +So the result rank of `⊐` is always `𝕩¬○=𝕨`, with a result shape `(Β¬=𝕨)↓≒𝕩`, and `π•¨βŠπ•©` fails if `1>=𝕨` or the result rank would be negative. In the list case, we have `1==𝕨` (so the first condition holds), and the result rank resolves to `=𝕩` (which can't be negative, so the second holds as well). The cell rank of `𝕩` is 0, and the fact that a 0-cell of `𝕩` gives a 0-cell of the result is what causes the shape arithmetic to be so simple. For Member of, the arguments are reversed relative to Index of, but otherwise everything's the same. This differs from APL, where entries are always elements, not cells. Many APL designers consider the APL definition to be a failure of foresight and would prefer BQN's definitionβ€”or rather A+'s or J's definition, as these languages were actually the first to use it. The rank-aware version is more flexible, as it allows both searching for elements and searching for rows. APL would return the first result in both cases below. diff --git a/docs/doc/search.html b/docs/doc/search.html index a6435518..b0722f12 100644 --- a/docs/doc/search.html +++ b/docs/doc/search.html @@ -251,7 +251,7 @@

Higher ranks -

So the result rank of ⊐ is always 𝕨¬○=𝕩, with a result shape (1-˜=𝕨)↓≒𝕩, and π•¨βŠπ•© fails if 1>=𝕩 or the result rank would be negative. In the list case, we have 1==𝕩 (so the first condition holds), and the result rank resolves to =𝕨 (which can't be negative, so the second holds as well). The cell rank of 𝕩 is 0, and the fact that a 0-cell of 𝕩 gives a 0-cell of the result is what causes the shape arithmetic to be so simple.

+

So the result rank of ⊐ is always 𝕩¬○=𝕨, with a result shape (Β¬=𝕨)↓≒𝕩, and π•¨βŠπ•© fails if 1>=𝕨 or the result rank would be negative. In the list case, we have 1==𝕨 (so the first condition holds), and the result rank resolves to =𝕩 (which can't be negative, so the second holds as well). The cell rank of 𝕩 is 0, and the fact that a 0-cell of 𝕩 gives a 0-cell of the result is what causes the shape arithmetic to be so simple.

For Member of, the arguments are reversed relative to Index of, but otherwise everything's the same. This differs from APL, where entries are always elements, not cells. Many APL designers consider the APL definition to be a failure of foresight and would prefer BQN's definitionβ€”or rather A+'s or J's definition, as these languages were actually the first to use it. The rank-aware version is more flexible, as it allows both searching for elements and searching for rows. APL would return the first result in both cases below.

↗️
    [2β€Ώ1,3β€Ώ1] ∊ 3β€Ώ1β€Ώ4β€Ώ3
 β”Œβ”€