diff options
| author | Marshall Lochbaum <mwlochbaum@gmail.com> | 2021-04-30 10:52:07 -0400 |
|---|---|---|
| committer | Marshall Lochbaum <mwlochbaum@gmail.com> | 2021-04-30 10:52:07 -0400 |
| commit | 768e5be04ef9fe11e2219c01b502614d3cf2764c (patch) | |
| tree | 29ba4ee56003cafe5a42e20bd8f9d621df8d9419 /src | |
| parent | 7c1fe4206ef5ce3aa9b0a66ce395e77b0c7291ca (diff) | |
Implement Indices using GroupLen
Diffstat (limited to 'src')
| -rw-r--r-- | src/r1.bqn | 11 |
1 files changed, 2 insertions, 9 deletions
@@ -193,15 +193,8 @@ _self←{ Indices←{ "/: Replication argument must have rank 1" ! 1==𝕩 - l←≠𝕩 - 0 Fill { - "/: Amounts to replicate must be natural numbers" ! 1×´Nat⌜𝕩 - k←l-1 - N ← ((⊢+-×0=𝕩⊑˜⊢)`k⊸-⌜↕l)⊑˜k-⊢ # Next nonzero - E ← ⊑⟜(+`𝕩) - ei←E i←N 0 - {{ei↩E i↩N𝕩+1⋄i}⍟(𝕩=ei)i}⌜↕E k - }⍟(0<l)𝕩 + "/: Amounts to replicate must be natural numbers" ! 1×´Nat⌜𝕩 + 0 Fill +`(0⌈≠-1˙)⊸↑GroupLen+`𝕩 } Rep ← Indices⊸⊏ SelfClas ← (PermInv∘⍋∘Rep˜⊏˜¯1+`⊢) _self |
