From 9a02c3ca3be3e8dfbe0e356b97131b6881638b55 Mon Sep 17 00:00:00 2001 From: Marshall Lochbaum Date: Thu, 29 Apr 2021 20:32:18 -0400 Subject: =?UTF-8?q?=5FgetCellCmp=20instead=20of=20<=CB=98=20for=20=5Fself?= =?UTF-8?q?=20implementation?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/r1.bqn | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/r1.bqn b/src/r1.bqn index d5f6b14e..d32df7b5 100644 --- a/src/r1.bqn +++ b/src/r1.bqn @@ -16,6 +16,7 @@ Pair ← {⟨𝕩⟩} ⊘ {⟨𝕨,𝕩⟩} ToArray ← <⍟(1-IsArray) Cell ← ↓⟜≢ MatchS ← 1×´=¨ +PermInv ← 1⌜⊸GroupOrd _qSearch ← {+´·×`𝕗(1-=)⌜<} _glyphLookup_ ← { @@ -182,6 +183,13 @@ _search←{ # 0 for ∊˜, 1 for ⊐ } ToArray𝕩 } } +_self←{ + "∊𝕩 or ⊐𝕩: 𝕩 must have rank at least 1" ! 1≤=𝕩 + g←⍋𝕩 + k←1×´1 Cell 𝕩 + cc ← (1-Match)○(⊑⟜(⥊𝕩)) _getCellCmp k + 0 Fill (PermInv g) ⊏ g 𝔽 0⊸<◶⟨1, -⟜1 CC○(⊑⟜(k⊸×⌜g)) ⊢⟩⌜↕≠𝕩 +} Indices←{ "/: Replication argument must have rank 1" ! 1==𝕩 @@ -196,6 +204,7 @@ Indices←{ }⍟(0