From 6caf40c6a2637470d3fe6a696d9a194e8592d8a4 Mon Sep 17 00:00:00 2001 From: Marshall Lochbaum Date: Sun, 6 Dec 2020 17:44:10 -0500 Subject: =?UTF-8?q?Check=20that=20argument=20to=20First=20Cell=20(?= =?UTF-8?q?=E2=8A=8F)=20has=20rank=20at=20least=201?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/r.bqn | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/r.bqn b/src/r.bqn index 89cf5e9a..d406ffd0 100644 --- a/src/r.bqn +++ b/src/r.bqn @@ -147,6 +147,10 @@ Suffixes←{ _sort ← {(𝕗⊑⟨Cmp,Cmp˜⟩)_grade_𝕗 ⊸ ⊏} +FirstCell←{ + "⊏𝕩: 𝕩 must have rank at least 1" ! 1≤=𝕩 + (<0) GetCells 𝕩 +} SelSub←{ "𝕨⊏𝕩: 𝕩 must be an array" ! IsArray 𝕨 "𝕨⊏𝕩: Indices in 𝕨 must be integers" ! 1×´⥊Int⌜ 𝕨 @@ -547,7 +551,7 @@ ReorderAxesInv←{ OccurrenceCount ← ⊐˜(⊢-⊏)⍋∘⍋ ProgressiveIndexOf ← {𝕨⊐○((≠∾2˙)⥊·≍˘⟜OccurrenceCount𝕨⊸⊐)𝕩} -⊏ ← (<0)⊸GetCells ⊘ (ToArray⊸(SelSub _onAxes_ 1)) +⊏ ← FirstCell ⊘ (ToArray⊸(SelSub _onAxes_ 1)) ⊑ ↩ (0⊑⥊) ⊘ Pick ◶ ↩ {𝕨((𝕨𝔽𝕩)⊑𝕘){𝔽}𝕩} # Same definition, new Pick -- cgit v1.2.3