From 763e019f1ae72bb3750ca79639549f868bae0091 Mon Sep 17 00:00:00 2001 From: Marshall Lochbaum Date: Sat, 24 Apr 2021 18:48:10 -0400 Subject: =?UTF-8?q?Special=20case=20for=20=E2=8A=91=20with=20number=20left?= =?UTF-8?q?=20argument?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/r.bqn | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/r.bqn b/src/r.bqn index 91b222c5..6912f6ea 100644 --- a/src/r.bqn +++ b/src/r.bqn @@ -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_ -- cgit v1.2.3