aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMarshall Lochbaum <mwlochbaum@gmail.com>2021-04-29 18:55:47 -0400
committerMarshall Lochbaum <mwlochbaum@gmail.com>2021-04-29 18:55:47 -0400
commitcebaf4fa85cd1a91c0324933bde4d4e986307016 (patch)
treed6cbef21a000427fa8ad89caa8962d395897d7e5 /src
parent8d5ba9918b866950dc413ec119670393388db4a5 (diff)
Move limited ¨ from r1 to r0
Diffstat (limited to 'src')
-rwxr-xr-xsrc/pr.bqn2
-rw-r--r--src/r0.bqn2
-rw-r--r--src/r1.bqn8
3 files changed, 6 insertions, 6 deletions
diff --git a/src/pr.bqn b/src/pr.bqn
index 560dd2b0..04b8a7fc 100755
--- a/src/pr.bqn
+++ b/src/pr.bqn
@@ -13,7 +13,7 @@ keep ← "!+-×÷⋆⌊=≤≢⥊⊑↕⌜`⊘⎊"
chrext ← glyphs ∾¨ ((+´·∧`'_'=0‿¯1⊸⊏)¨def) ⊔ alias
Typ ← chrext⊸((+`≠¨)∘⊣⍋∾⊸⊐)
-in0‿out0 ← ⟨"∩⍝+-×⌊=≤≢⥊⊑↕⌜⊘", "⌊⌈|<>≠≥⊢⊣∾↑↓⊏˙˜´∘○⊸⟜◶⍟"⟩
+in0‿out0 ← ⟨"∩⍝+-×⌊=≤≢⥊⊑↕⌜⊘", "⌊⌈|<>≠≥⊢⊣∾↑↓⊏˙˜¨´∘○⊸⟜◶⍟"⟩
in2 ← alias∾keep
out2 ← ∾glyphs
in‿out ← rtt ⊑ ⟨in0,out0⟩‿⟨⍷in2∾out0,out2⟩‿⟨in2,out2⟩
diff --git a/src/r0.bqn b/src/r0.bqn
index 8347f8bf..a7b7f4c4 100644
--- a/src/r0.bqn
+++ b/src/r0.bqn
@@ -30,6 +30,8 @@ Box ← {𝕩Fill⟨⟩⥊⟨𝕩⟩}
↑ ← {⊑⟜𝕩⌜↕𝕨} # LIMITED to number 𝕨 and list 𝕩
↓ ← {(𝕨⊸+⊑𝕩˙)⌜↕(≠𝕩)-𝕨} # LIMITED to number 𝕨 and list 𝕩
+¨ ← { d←⥊𝕩⋄(≢𝕩)⥊(⊑⟜(⥊𝕨)𝔽⊑⟜d)⌜↕≠d } # LIMITED to equal-shape arrays
+
_fold0←{
l←≠𝕩 ⋄ F←𝔽
r←𝕨 {l↩l-1⋄l⊑𝕩}⊘⊣ 𝕩
diff --git a/src/r1.bqn b/src/r1.bqn
index 1df11c08..9351c986 100644
--- a/src/r1.bqn
+++ b/src/r1.bqn
@@ -15,6 +15,7 @@ Deshape ← IsArray◶{𝕩Fill⟨𝕩⟩}‿⥊
Pair ← {⟨𝕩⟩} ⊘ {⟨𝕨,𝕩⟩}
ToArray ← <⍟(1-IsArray)
Cell ← ↓⟜≢
+MatchS ← 1×´=¨
_qSearch ← {+´·×`𝕗(1-=)⌜<}
_glyphLookup_ ← {
@@ -42,9 +43,6 @@ _fold←{
𝕨 (0<≠)⊘1◶⟨Identity 𝕗˙, 𝔽´⟩ 𝕩
}
-¨ ← { d←⥊𝕩⋄(≢𝕩)⥊(⊑⟜(⥊𝕨)𝔽⊑⟜d)⌜↕≠d } # LIMITED to equal-shape array arguments
-MatchS ← 1×´=¨
-
_eachd←{
_d←{ # Equal ranks
p←≢𝕨
@@ -431,7 +429,7 @@ _takeDrop←{
_c ← { (×⟜𝕗⌜𝕨) +⌜ 𝕩 }
i←<0 ⋄ k←1 ⋄ UIk←{ i (k×𝕨)_c↩ k ↕⊸(𝕨_c)⍟(1-=⟜1) 𝕩 ⋄ k↩1 ⋄ ≠𝕩 }
doFil←0
- sh ← s Noop◶{k×↩𝕨⋄𝕨}‿(⊣ UIk {𝕩⋄doFil↩1}_inds)¨ 𝕨
+ sh ← (r↑s) Noop◶{k×↩𝕨⋄𝕨}‿(⊣ UIk {𝕩⋄doFil↩1}_inds)¨ 𝕨
(0<=i)◶(s⊸⥊)‿{
sh ∾↩ t ← r↓s
{i 𝕩_c↩ ↕𝕩}⍟(1-1⊸=) k×´t
@@ -482,7 +480,7 @@ Windows←{
"𝕨↕𝕩: Length of 𝕨 must be at most rank of 𝕩" ! r≤=𝕩
"𝕨↕𝕩: 𝕨 must consist of natural numbers" ! ×´Nat⌜𝕨
s←≢𝕩
- l←s(1+-)¨𝕨
+ l←(r↑s)(1+-)¨𝕨
"𝕨↕𝕩: Window length 𝕨 must be at most axis length plus one" ! ×´0⊸≤⌜l
k←1×´t←r↓s
str ← Reverse ×`⟨k⟩∾s⊏˜{𝕩⊸-⌜↕𝕩}r-1