aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMarshall Lochbaum <mwlochbaum@gmail.com>2021-04-30 10:52:07 -0400
committerMarshall Lochbaum <mwlochbaum@gmail.com>2021-04-30 10:52:07 -0400
commit768e5be04ef9fe11e2219c01b502614d3cf2764c (patch)
tree29ba4ee56003cafe5a42e20bd8f9d621df8d9419 /src
parent7c1fe4206ef5ce3aa9b0a66ce395e77b0c7291ca (diff)
Implement Indices using GroupLen
Diffstat (limited to 'src')
-rw-r--r--src/r1.bqn11
1 files changed, 2 insertions, 9 deletions
diff --git a/src/r1.bqn b/src/r1.bqn
index 57166278..36f9f90c 100644
--- a/src/r1.bqn
+++ b/src/r1.bqn
@@ -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