diff options
| author | Marshall Lochbaum <mwlochbaum@gmail.com> | 2021-04-24 18:48:10 -0400 |
|---|---|---|
| committer | Marshall Lochbaum <mwlochbaum@gmail.com> | 2021-04-24 18:48:10 -0400 |
| commit | 763e019f1ae72bb3750ca79639549f868bae0091 (patch) | |
| tree | 40ef158615520f1487580c49633957aac33521bb /src | |
| parent | 09231a35b513400bfd0b4f04dd0aba3a96f21daa (diff) | |
Special case for ⊑ with number left argument
Diffstat (limited to 'src')
| -rw-r--r-- | src/r.bqn | 13 |
1 files changed, 10 insertions, 3 deletions
@@ -227,6 +227,14 @@ SelSub←{ } First ← (0<≠)◶⟨Fill,0⊸⊑⟩ Deshape +eRange←"𝕨⊑𝕩: Index out of range" +ChkInd←"𝕨⊑𝕩: Indices in 𝕨 must consist of integers" ! Int +Pick0←{ + "𝕨⊑𝕩: 𝕩 must be a list when 𝕨 is a number" ! 1==𝕩 + ChkInd 𝕨 + 𝕩⊑˜(≠𝕩)0⊸≤◶⟨(⊢⊣eRange!0⊸≤)+,⊢⊣eRange!>⟩𝕨 +} + IsPure ← {d←Decompose𝕩 ⋄ 2⊸≤◶⟨≤⟜0, 1(𝕊d⊑˜1⊸+)⊸×´·↕1-˜≠∘d⟩0⊑d} _fillByPure_←{ 𝕘 (3≤Type∘⊣)◶⟨{𝕨Fill𝕏},{(𝕨HomFil𝕩)_fillBy_𝕨}⍟(IsPure⊣)⟩ 𝕗 @@ -621,13 +629,12 @@ GroupGen←{ Pick1←{ "𝕨⊑𝕩: Indices in compound 𝕨 must be lists" ! 1==𝕨 "𝕨⊑𝕩: Index length in 𝕨 must match rank of 𝕩" ! 𝕨=○≠s←≢𝕩 - "𝕨⊑𝕩: Indices in 𝕨 must consist of integers" ! 1∧´Int⌜𝕨 - "𝕨⊑𝕩: Index out of range" ! 1∧´𝕨(≥⟜-∧<)s + ChkInd⌜𝕨 ⋄ eRange ! 1∧´𝕨(≥⟜-∧<)s 𝕨↩𝕨+s×𝕨<0 (⥊𝕩)⊑˜0(⊑⟜𝕨+⊑⟜s×⊢)´-↕⊸¬≠𝕨 } Pickd←(0∨´IsArray⌜∘⥊∘⊣)◶Pick1‿{Pickd⟜𝕩⌜𝕨} -Pick←IsArray◶⥊‿⊢⊸Pickd +Pick←IsArray∘⊣◶Pick0‿Pickd ⚇ ← _depthOp_ ⎉ ← _rankOp_ |
