aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarshall Lochbaum <mwlochbaum@gmail.com>2020-08-03 22:41:10 -0400
committerMarshall Lochbaum <mwlochbaum@gmail.com>2020-08-03 22:41:10 -0400
commit89289fe19a4a0aa9866f299855d17a00df21332d (patch)
treece161d27b7d6573517455f4677d3f8f7ce2a1eaf
parent046415773ace47b6b4e1a3747d115ef308548631 (diff)
Make the complicated parts of Take conditional
-rw-r--r--impl.bqn6
1 files changed, 3 insertions, 3 deletions
diff --git a/impl.bqn b/impl.bqn
index caeab991..38ec5adf 100644
--- a/impl.bqn
+++ b/impl.bqn
@@ -217,9 +217,9 @@ JoinTo←∨○(1≠=)◶∾‿{
Take←{
T←{
! Int 𝕨
- l←≠𝕩
- i←(l+1)|¯1⌈l⌊((𝕨<0)×𝕨+l)+↕|𝕨
- i⊏JoinTo⟜(1⊸Cell⥊Type)⍟(∨´l=i)𝕩
+ l←≠𝕩 ⋄ n←𝕨<0 ⋄ e←l⌊r←|𝕨 ⋄ s←⟨r⟩
+ i ← 𝕩{s∾↩c←1 Cell 𝕨⋄𝕩(×+⌜↕∘⊢)×´c}⍟(1≠=𝕩) (l-e)+⍟n ↕e
+ s ⥊ 𝕩{(⥊𝕩)n◶⟨∾,∾˜⟩(r-e)⥊Type𝕗}⍟(l<r) ⊑⟜(⥊𝕩)¨i
}
𝕨 T _onAxes_ 0 (⟨1⟩⥊˜0⌈𝕨-○≠⊢)⊸∾∘≢⊸⥊𝕩
}