From d446fa485c2cb826e5619c0067ab19919dafa4e2 Mon Sep 17 00:00:00 2001 From: Marshall Lochbaum Date: Thu, 6 Aug 2020 16:21:49 -0400 Subject: Non-pervasive SelSub --- impl.bqn | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/impl.bqn b/impl.bqn index 90d5f6fb..f0bdec87 100644 --- a/impl.bqn +++ b/impl.bqn @@ -136,6 +136,19 @@ _under_←{ ≤ ↩ !∘0 ⊘ (≤ _perv) identity ← (0⊑⟨!∘0⟩) {(0⊑𝕨){𝕗=𝕩}◶𝕩‿(1⊑𝕨)}´ ⟨+‿0,-‿0,×‿1,÷‿1,⋆‿1,√‿1,∧‿1,∨‿0,|‿0,⌊‿∞,⌈‿¯∞,<‿0,≤‿1,=‿1,≥‿1,>‿0,≠‿0⟩ +SelSub←{ + ! IsArray 𝕨 + ! 1×´⥊Int¨ 𝕨 + l←≠𝕩 + ! 1×´⥊ ((-l)⊸≤×l⊸>)¨ 𝕨 + ((⊢+l×0>⊢)¨𝕨)(1==𝕩)◶{ + c←1×´s←1 Cell 𝕩 + 𝕨((⥊𝕩)⊑˜c⊸×⊸+)⌜s⥊↕c + }‿{ + ⊑⟜𝕩¨𝕨 + }𝕩 +} + #⌜ # LAYER 3: Remove other limits @@ -226,18 +239,6 @@ _onAxes_←{ } } -SelSub←{ - ! IsArray 𝕨 - ! ∧´⥊Int¨ 𝕨 - ! ∧´⥊ 𝕨 (≥⟜-∧<) ≠𝕩 - 𝕨↩𝕨+(≠𝕩)×𝕨<0 - 𝕨(1≠=∘⊢)◶{ - ⊑⟜𝕩¨𝕨 - }‿{ - c←×´s←1 Cell 𝕩 - ⊑⟜(⥊𝕩)¨(c×𝕨)+⌜s⥊↕c - }𝕩 -} Select←ToArray⊸(SelSub _onAxes_ 1) ⊏ ← 0⊸Select ⊘ Select -- cgit v1.2.3