diff options
| author | Marshall Lochbaum <mwlochbaum@gmail.com> | 2021-04-26 20:43:49 -0400 |
|---|---|---|
| committer | Marshall Lochbaum <mwlochbaum@gmail.com> | 2021-04-26 20:43:49 -0400 |
| commit | d230e170c4520b78893c2e09131158af90ef1989 (patch) | |
| tree | dbe5472318f13f56d40f67b7f7c4251302df5827 /src | |
| parent | 6982a91a985f0961d3adce83bfd75a2d2cbb19ca (diff) | |
Minor rearrangement
Diffstat (limited to 'src')
| -rw-r--r-- | src/r.bqn | 27 |
1 files changed, 13 insertions, 14 deletions
@@ -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 |
