From fa961e09348825266125da3185918aeee0119abe Mon Sep 17 00:00:00 2001 From: Jeremy Howard Date: Thu, 12 Nov 2026 20:49:46 +1000 Subject: [PATCH] =?UTF-8?q?Extend=20Axis=20with=20singleton=20dimensions?= =?UTF-8?q?=20and=20replace=20=E2=8A=96=20with=20=E2=8C=BD=E2=82=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- DEV.md | 2 +- .../BPL.tmbundle/Syntaxes/bpl.tmLanguage.json | 4 +- .../BPL.tmbundle/Syntaxes/hpl.tmLanguage.json | 4 +- editors/jetbrains/BPL.xml | 15 ---- editors/vim/syntax/bpl.vim | 4 +- editors/windows/layout.h | 2 - lib/array.bpl | 2 +- lib/dyalog.bpl | 4 +- lib/graph.bpl | 2 +- lib/numeric.bpl | 2 +- lib/tree.bpl | 4 +- nbs/bpl.xml | 4 +- nbs/evaluation.qmd | 2 +- nbs/gallery/reaction.bpl | 2 +- nbs/glyphs.qmd | 2 +- nbs/glyphs/circle-bar.qmd | 18 ----- nbs/glyphs/circle-stile.qmd | 9 ++- nbs/glyphs/jot-diaeresis.qmd | 2 +- nbs/glyphs/quad-colon.qmd | 14 +++- nbs/hpl.xml | 4 +- nbs/keyboard.qmd | 2 +- nbs/llms.txt | 2 +- nbs/principles.ipynb | 2 +- nbs/study/01_basics.ipynb | 6 +- nbs/study/06_rearranging-arrays.ipynb | 20 +++--- .../Contents/Resources/BasedPL-de.keylayout | 12 ---- .../Contents/Resources/BasedPL-es.keylayout | 12 ---- .../Contents/Resources/BasedPL-fr.keylayout | 12 ---- .../Contents/Resources/BasedPL-uk.keylayout | 12 ---- .../Contents/Resources/BasedPL-us.keylayout | 12 ---- python/basedpl/bpl.tmLanguage.json | 4 +- python/basedpl/browser/language.js | 4 +- python/basedpl/browser/layout.json | 2 +- python/basedpl/hpl.tmLanguage.json | 4 +- src/batch.rs | 4 +- src/derivative.rs | 2 +- src/derivative/tape.rs | 4 +- src/eval/operators/axes.rs | 7 +- src/eval/operators/rank.rs | 13 +++- src/primitive.rs | 40 ++++++++++- src/primitive/facts.rs | 19 ++--- src/primitive/inverse.rs | 10 ++- src/primitive/structural.rs | 9 ++- src/symbols.rs | 22 +++--- tests/core.rs | 15 +++- tests/reference/aplcart.bpl | 70 +++++++++---------- tests/reference/april.bpl | 18 ++--- tests/reference/bqn.bpl | 2 +- tests/reference/core.bpl | 42 +++++------ tests/reference/ngn.bpl | 16 ++--- tests/speed/arrays.bpl | 12 ++-- tests/speed/structure.bpl | 2 +- tests/test_kernel.py | 2 +- tests/test_keylayout.py | 2 +- 54 files changed, 248 insertions(+), 271 deletions(-) delete mode 100644 nbs/glyphs/circle-bar.qmd diff --git a/DEV.md b/DEV.md index efa20662..a59dd193 100644 --- a/DEV.md +++ b/DEV.md @@ -378,7 +378,7 @@ Rank tries `whole` before `each_pair`. `whole`, in order: 4. `pervasive_cells`: a pervasive primitive under nested Rank; 5. monadic operand: `cell_rule`, which also takes folds, atops and a bound left argument. -- `primitive_cells` runs a primitive on the whole argument along the cells' axes. A form that `extends` runs whole at a cell rank at least its own. Other forms follow the `cells` fact (`CellRule`) in their `Primitive::info()` row: `⊖ , ↑ ↓ ⌷ #` and rotate-first call their axis forms; `⍉` sends each cell's axes after the frame's; `≢`, `ρ` give constants; a reshape keeping a cell's items in order is a view; `⊂` encloses each cell of rank 1 or more via its axis form, whose cells are views of the argument's items. Any other form with a left argument every cell shares takes `paired_cells`. +- `primitive_cells` runs a primitive on the whole argument along the cells' axes. A form that `extends` runs whole at a cell rank at least its own. Other forms follow the `cells` fact (`CellRule`) in their `Primitive::info()` row: `, ↑ ↓ ⌷ #` call their axis forms; `⍉` sends each cell's axes after the frame's; `≢`, `ρ` give constants; a reshape keeping a cell's items in order is a view; `⊂` encloses each cell of rank 1 or more via its axis form, whose cells are views of the argument's items. Any other form with a left argument every cell shares takes `paired_cells`. `⌽₀` selects each cell's first axis through the shared Axis route. - `paired_cells`: joins each pair of cells for `,` and `⍪`; calls a form that extends once where both cells are at least its ranks; first repeats an argument every cell shares over the frame (`agreement::spread`). - `padded_call`, `paired_cells` leave an argument with a named frame axis to the per-cell path, which pairs frames by name (`named_frame`). Names on cell axes pair in whole calls as per-cell calls pair them. - A pervasive primitive folds or scans a simple array along the cell's axis (`folded_cells`); `f/∘,` folds all cell axes at once. An atop applies its inner function's rule, then Rank for its outer function. diff --git a/editors/jetbrains/BPL.tmbundle/Syntaxes/bpl.tmLanguage.json b/editors/jetbrains/BPL.tmbundle/Syntaxes/bpl.tmLanguage.json index c8007243..298d8386 100644 --- a/editors/jetbrains/BPL.tmbundle/Syntaxes/bpl.tmLanguage.json +++ b/editors/jetbrains/BPL.tmbundle/Syntaxes/bpl.tmLanguage.json @@ -45,7 +45,7 @@ "name": "string.quoted.single.bpl" }, { - "match": "(?:_\\d+|_\\S|_|[^\\s\\p{Cc}0-9←⎕•αω⍶⍹∇⍢⍝◇⁝\\?¯∞⍬\\+\\-×÷⌈⌊\\|\\*⊛○π√!∧∨⊼⊽\\~=≠<≤>≥ι↦:ρ≢≡,⍪⊂⊃⊆∊∪∩⍋⍒↑↓⌽⊖⍉⊤⊥⍎⍕⌷⌹\\#↕⍭⨸⌻⍸⍷⊢⊣¿¨ᵇ⍨↣⍤∘⍠⍥↢\\.⊗⌸⍣⇄⊘@∂⍚⌺/⌿\\\\⍀⁻⁰¹²³⁴⁵⁶⁷⁸⁹⁻ᵀᵘₓ₀₁₂₃₄₅₆₇₈₉₋ₓ₁ₓ₂ₓ₄ₓ₈ₓₕₛₚₐᵣ\\(\\)\\[\\]\\{\\}'\";\\$_ₑⱼᵣ])+", + "match": "(?:_\\d+|_\\S|_|[^\\s\\p{Cc}0-9←⎕•αω⍶⍹∇⍢⍝◇⁝\\?¯∞⍬\\+\\-×÷⌈⌊\\|\\*⊛○π√!∧∨⊼⊽\\~=≠<≤>≥ι↦:ρ≢≡,⍪⊂⊃⊆∊∪∩⍋⍒↑↓⌽⍉⊤⊥⍎⍕⌷⌹\\#↕⍭⨸⌻⍸⍷⊢⊣¿¨ᵇ⍨↣⍤∘⍠⍥↢\\.⊗⌸⍣⇄⊘@∂⍚⌺/⌿\\\\⍀⁻⁰¹²³⁴⁵⁶⁷⁸⁹⁻ᵀᵘₓ₀₁₂₃₄₅₆₇₈₉₋ₓ₁ₓ₂ₓ₄ₓ₈ₓₕₛₚₐᵣ\\(\\)\\[\\]\\{\\}'\";\\$_ₑⱼᵣ])+", "name": "variable.other.bpl" }, { @@ -86,7 +86,7 @@ } }, { - "match": "[\\+\\-×÷⌈⌊\\|\\*⊛○π√!∧∨⊼⊽\\~=≠<≤>≥ι↦:ρ≢≡,⍪⊂⊃⊆∊∪∩⍋⍒↑↓⌽⊖⍉⊤⊥⍎⍕⌷⌹\\#↕⍭⨸⌻⍸⍷⊢⊣¿]", + "match": "[\\+\\-×÷⌈⌊\\|\\*⊛○π√!∧∨⊼⊽\\~=≠<≤>≥ι↦:ρ≢≡,⍪⊂⊃⊆∊∪∩⍋⍒↑↓⌽⍉⊤⊥⍎⍕⌷⌹\\#↕⍭⨸⌻⍸⍷⊢⊣¿]", "name": "support.function.bpl" }, { diff --git a/editors/jetbrains/BPL.tmbundle/Syntaxes/hpl.tmLanguage.json b/editors/jetbrains/BPL.tmbundle/Syntaxes/hpl.tmLanguage.json index cf1fd6bf..51f0b64a 100644 --- a/editors/jetbrains/BPL.tmbundle/Syntaxes/hpl.tmLanguage.json +++ b/editors/jetbrains/BPL.tmbundle/Syntaxes/hpl.tmLanguage.json @@ -19,7 +19,7 @@ "applyEndPatternLast": true }, { - "match": "(?:_\\d+|_\\S|_|[^\\s\\p{Cc}0-9←是⎕出入•系α甲ω乙⍶丙⍹丁∇递遞⍢循⍝注◇句⁝隔\\?若¯负負∞永⍬空\\+加\\-减減×乘号號÷除⌈上⌊下\\|绝余絕餘\\*幂冪⊛对對○圆圓π周√根!阶拣階揀∧极且極∨析或⊼方否⊽双莫雙\\~非无無=等≠别初別<小≤限退>大≥达进達進ι位↦至:键卸鍵ρ形≢数异數異≡同深,连連⍪接矩⊂包⊃选合選⊆巢段∊属展屬∪并独併獨∩交重⍋升⍒降↑取↓去拆⌽转轉⊖纵縱⍉翻⊤编編⊥译譯⍎行⍕文⌷索⌹解逆\\#复複↕窗⍭素⨸因⌻零值⍸处间處間⍷寻群尋⊢右⊣左¿掷抽擲¨遍ᵇ按⍨己换換↣先⍤秩∘承⍠轴軸⍥经經↢后後\\.内內⊗表⌸组組⍣次止⇄优優⊘兼@于於∂导梯導⍚择擇⌺邻鄰/总總⌿汇匯\\\\累⍀续續⁻反⁰¹²³⁴⁵⁶⁷⁸⁹⁻ᵀᵘₓ₀₁₂₃₄₅₆₇₈₉₋ₓ₁ₓ₂ₓ₄ₓ₈ₓₕₛₚₐᵣ\\(\\)\\[\\]\\{\\}'\";\\$_ₑⱼᵣ])+", + "match": "(?:_\\d+|_\\S|_|[^\\s\\p{Cc}0-9←是⎕出入•系α甲ω乙⍶丙⍹丁∇递遞⍢循⍝注◇句⁝隔\\?若¯负負∞永⍬空\\+加\\-减減×乘号號÷除⌈上⌊下\\|绝余絕餘\\*幂冪⊛对對○圆圓π周√根!阶拣階揀∧极且極∨析或⊼方否⊽双莫雙\\~非无無=等≠别初別<小≤限退>大≥达进達進ι位↦至:键卸鍵ρ形≢数异數異≡同深,连連⍪接矩⊂包⊃选合選⊆巢段∊属展屬∪并独併獨∩交重⍋升⍒降↑取↓去拆⌽转轉⍉翻⊤编編⊥译譯⍎行⍕文⌷索⌹解逆\\#复複↕窗⍭素⨸因⌻零值⍸处间處間⍷寻群尋⊢右⊣左¿掷抽擲¨遍ᵇ按⍨己换換↣先⍤秩∘承⍠轴軸⍥经經↢后後\\.内內⊗表⌸组組⍣次止⇄优優⊘兼@于於∂导梯導⍚择擇⌺邻鄰/总總⌿汇匯\\\\累⍀续續⁻反⁰¹²³⁴⁵⁶⁷⁸⁹⁻ᵀᵘₓ₀₁₂₃₄₅₆₇₈₉₋ₓ₁ₓ₂ₓ₄ₓ₈ₓₕₛₚₐᵣ\\(\\)\\[\\]\\{\\}'\";\\$_ₑⱼᵣ])+", "name": "variable.other.bpl" }, { @@ -35,7 +35,7 @@ "name": "constant.numeric.bpl" }, { - "match": "[加减減乘号號除上下绝余絕餘幂冪对對圆圓周根阶拣階揀极且極析或方否双莫雙非无無等别初別小限退大达进達進位至键卸鍵形数异數異同深连連接矩包选合選巢段属展屬并独併獨交重升降取去拆转轉纵縱翻编編译譯行文索解逆复複窗素因零值处间處間寻群尋右左掷抽擲]", + "match": "[加减減乘号號除上下绝余絕餘幂冪对對圆圓周根阶拣階揀极且極析或方否双莫雙非无無等别初別小限退大达进達進位至键卸鍵形数异數異同深连連接矩包选合選巢段属展屬并独併獨交重升降取去拆转轉翻编編译譯行文索解逆复複窗素因零值处间處間寻群尋右左掷抽擲]", "name": "support.function.bpl" }, { diff --git a/editors/jetbrains/BPL.xml b/editors/jetbrains/BPL.xml index 9416ebb6..848b519e 100644 --- a/editors/jetbrains/BPL.xml +++ b/editors/jetbrains/BPL.xml @@ -114,11 +114,6 @@