diff options
| author | Marshall Lochbaum <mwlochbaum@gmail.com> | 2020-12-06 17:44:10 -0500 |
|---|---|---|
| committer | Marshall Lochbaum <mwlochbaum@gmail.com> | 2020-12-06 17:44:10 -0500 |
| commit | 6caf40c6a2637470d3fe6a696d9a194e8592d8a4 (patch) | |
| tree | 4123adb440d8b047b1b97286c5d742fa59a0406f /src | |
| parent | 0106c2650d11594331234250e051edf89516f366 (diff) | |
Check that argument to First Cell (⊏) has rank at least 1
Diffstat (limited to 'src')
| -rw-r--r-- | src/r.bqn | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -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 |
