aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/r.bqn27
1 files changed, 13 insertions, 14 deletions
diff --git a/src/r.bqn b/src/r.bqn
index 2136b78e..fab5d8ab 100644
--- a/src/r.bqn
+++ b/src/r.bqn
@@ -691,8 +691,6 @@ _repeat_←{
(Nat n)◶Multi‿{𝕩(B f)∘⊢´↕n} 𝕩
}
-↑ ↩ Prefixes ⊘ Take
-↓ ↩ Suffixes ⊘ Drop
↕ ↩ Range ⊘ Windows
⌽ ← Reverse ⊘ (Rot _onAxes_ 0)
/ ← Indices ⊘ Replicate
@@ -711,7 +709,11 @@ GroupM←{
(LS 0⌜𝕨) Fill dr (1≠≠∘⊢)◶⟨S _group○(0⊸⊑), S⌜ ·+⌜⌜´ (⌽×`1»⌽l) × ⊢_group¨⟩ 𝕨
}
-˝ ← _insert
+↑ ↩ Prefixes ⊘ Take
+↓ ↩ Suffixes ⊘ Drop
+⊔ ← GroupInds ⊘ GroupGen
+⊐ ← SelfClas ⊘ (1 _search)
+∊ ← ⊢_self ⊘ (0 _search˜)
⎉ ← _rankOp_
Find←{
@@ -720,9 +722,13 @@ Find←{
0 Fill 𝕨 ≡⎉r ((1+r-⊸↑≢𝕩)⌊≢𝕨)⊸↕⎉r 𝕩
}○ToArray
-⊔ ← GroupInds ⊘ GroupGen
-⊐ ← SelfClas ⊘ (1 _search)
-∊ ← ⊢_self ⊘ (0 _search˜)
+OccurrenceCount ← 0 Fill ⊐˜(⊢-⊏)⍋∘⍋
+ProgressiveIndexOf ← 0 Fill {
+ c←1-˜=𝕨
+ "⊒: Rank of 𝕨 must be at least 1" ! 0≤c
+ "⊒: Rank of 𝕩 must be at least cell rank of 𝕨" ! c≤=𝕩
+ 𝕨⊐○(Pair¨⟜(≢⥊OccurrenceCount∘⥊) 𝕨⊸⊐)𝕩
+}
ReorderChk←{
"𝕨⍉𝕩: 𝕨 must have rank at most 1" ! 1≥=𝕨
@@ -747,14 +753,6 @@ ReorderAxesInv←{
(PermInv 𝕨∾𝕨(¬∘∊˜/⊢)↕r) ReorderAxesSub 𝕩
}
-OccurrenceCount ← 0 Fill ⊐˜(⊢-⊏)⍋∘⍋
-ProgressiveIndexOf ← 0 Fill {
- c←1-˜=𝕨
- "⊒: Rank of 𝕨 must be at least 1" ! 0≤c
- "⊒: Rank of 𝕩 must be at least cell rank of 𝕨" ! c≤=𝕩
- 𝕨⊐○(Pair¨⟜(≢⥊OccurrenceCount∘⥊) 𝕨⊸⊐)𝕩
-}
-
⁼ ← {Inverse 𝕗}
_inv_ ← {𝕘⋄𝕨𝔽𝕩}
_undo ← {𝕗 (≢∧INF˙⊸≢)◶0‿((5=0⊸⊑)◶1‿(inv˙≢(≠-2˙)⊸⊑)∘Decompose⊢)◶⊢‿{𝕏_inv_(𝕎_invChk_𝕏)} Inverse 𝕗}
@@ -853,6 +851,7 @@ Mod2Inverse ← INF˙ _lookup_ ⟨
'⟜', {(𝕨IsConstant∘⊢◶⟨IA∘0˙,{𝕩𝕎{SwapInverse𝕗}⊢}⟩𝕩)⊘(𝕏⁼𝕎⁼)}
⟩ { inv˙⊸=◶⟨𝔽,{𝕏_inv_𝕎}˙⟩ }
+˝ ← _insert
⁼ ↩ _undo
⊑ ↩ First ⊘ Pick
◶ ↩ {𝕨((𝕨𝔽𝕩)⊑𝕘){𝔽}𝕩} # Same definition, new Pick