aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xdzref_full45
1 files changed, 22 insertions, 23 deletions
diff --git a/dzref_full b/dzref_full
index d8902c61..b8322362 100755
--- a/dzref_full
+++ b/dzref_full
@@ -72,7 +72,7 @@ identity ← {(0⊑𝕨){𝕗=𝕩}◶𝕩‿(1⊑𝕨)}´ ⟨+‿0,-‿0,×‿1
#⌜
# LAYER 3: Remove other limits
-# Now all implementations are full except ∾; ↕ is monadic only
+# Now all implementations are full except ∾ and ⊑; ↕ is monadic only
Int←IsArray◶⟨⌊⊸=,0⟩
Nat←IsArray◶⟨0⊸≤∧⌊⊸=,0⟩
@@ -96,17 +96,6 @@ Range←{
IsArray◶I‿M 𝕩
}
-Pick1←{
- ! 1==𝕨
- ! 𝕨=○≠s←≢𝕩
- ! ∧´Int¨𝕨
- ! ∧´𝕨(≥⟜-∧<)s
- 𝕨↩𝕨+s×𝕨<0
- (⥊𝕩)⊑˜0(⊑⟜𝕨+⊑⟜s×⊢)´-↕⊸¬≠𝕨
-}
-Pickd←(∨´∘⥊IsArray¨∘⊣)◶Pick1‿{Pickd⟜𝕩¨𝕨}
-Pick←IsArray◶⥊‿⊢⊸Pickd
-
match←{¬∘(0⊑𝕨)◶(1⊑𝕨)‿𝕩}´⟨
⟨≠○IsArray , 0⟩
⟨¬IsArray∘⊢, =⟩
@@ -117,9 +106,7 @@ match←{¬∘(0⊑𝕨)◶(1⊑𝕨)‿𝕩}´⟨
Depth←IsArray◶0‿{1+0⌈´Depth¨⥊𝕩}
-⊑ ↩ (0¨∘≢)⊸Pick ⊘ Pick
↕ ↩ Range
-◶ ↩ {𝕨((𝕨𝔽𝕩)⊑𝕘){𝔽}𝕩} # Same definition, new Pick
≡ ← Depth ⊘ Match
≢ ↩ ≢ ⊘ (¬Match)
@@ -136,7 +123,7 @@ Pair ← {⟨𝕩⟩} ⊘ {⟨𝕨,𝕩⟩}
Merge←(0<≠∘⥊)◶⊢‿{
c←≢⊑𝕩
! ∧´⥊(c≡≢)¨𝕩
- 𝕩⊑⟜ToArray˜⌜↕c
+ 𝕩⊑⟜⥊˜⌜c⥊↕×´c
}
> ↩ Merge ⊘ >
≍ ← >∘Pair
@@ -157,7 +144,7 @@ _rankOp_←{
c←×´s←𝕨Cell𝕩
f⥊⊑⟜(⥊𝕩)¨∘((s⥊↕c)+c×⊢)¨↕×´f
}
- > ((⊑k)Enc𝕨) 𝔽¨ ((1-˜≠)⊸⊑k)Enc𝕩
+ > ((0⊑k)Enc𝕨) 𝔽¨ ((1-˜≠)⊸⊑k)Enc𝕩
}
_scan←{
! IsArray 𝕩
@@ -172,7 +159,7 @@ _scan←{
` ← _scan
_repeat_←{
n←𝕨𝔾𝕩
- f←⊑𝕨⟨𝔽⟩⊘⟨𝕨𝔽⊢⟩𝕩
+ f←0⊑𝕨⟨𝔽⟩⊘⟨𝕨𝔽⊢⟩𝕩
l←u←0
{!Int𝕩⋄l↩l⌊𝕩⋄u↩u⌈𝕩}⚇0 n
a←𝕩⋄_p←{𝔽∘⊣`(1+𝕩)⥊<a}
@@ -201,7 +188,7 @@ _onAxes_←{
}‿{ # Multiple axes
! 1≥=𝕨
! 𝕨≤○≠≢𝕩
- R←{(⊑𝕨)F(1 DropV 𝕨)⊸R˘𝕩}⍟{0<≠𝕨}
+ R←{(0⊑⥊𝕨)F(1 DropV 𝕨)⊸R˘𝕩}⍟{0<≠𝕨}
𝕨R𝕩
}
}
@@ -223,8 +210,8 @@ JoinTo←{
! ∧´1≥a-k
c←(k¬a)+⟜(↕a-1)⊸⊏¨s
! ≡´c
- l←+´(a=k)⊣◶1‿(⊑⊢)¨s
- (⟨l⟩∾⊑c)⥊𝕨∾○⥊𝕩
+ l←+´(a=k)⊣◶1‿(0⊑⊢)¨s
+ (⟨l⟩∾0⊑c)⥊𝕨∾○⥊𝕩
}
Take←{
@@ -274,17 +261,16 @@ Replicate ← {0<=𝕨}◶(⥊˜⟜≠Rep⊢)‿{!𝕨=○≠𝕩⋄𝕨Rep𝕩}
#⌜
# LAYER 6: Everything else
-
Join←{
C←(<⟨⟩)⥊⊸∾⌜´⊢ # Cartesian array product
! IsArray 𝕩
s←≢¨𝕩
- d←≠⊑s
+ d←≠0⊑⥊s
! ∧´⥊d=≠¨s
! d≥=𝕩
l←(≢𝕩){(𝕩⊑⟜≢a⊑˜(j=𝕩)⊸×)¨↕𝕨}¨j←↕r←=a←𝕩
! (r↑¨s)≡C l
- i←C{p←+´¨↑𝕩⋄(↕⊑⌽p)-𝕩/¯1↓p}¨l
+ i←C{p←+´¨↑𝕩⋄(↕0⊑⌽p)-𝕩/¯1↓p}¨l
>i<¨⊸⊏¨l/𝕩
}⍟(0<≠∘⥊)
@@ -300,6 +286,19 @@ Group←{
∾ ↩ Join ⊘ JoinTo
⊔ ← Group⟜(↕≠⚇1) ⊘ Group
+Pick1←{
+ ! 1==𝕨
+ ! 𝕨=○≠s←≢𝕩
+ ! ∧´Int¨𝕨
+ ! ∧´𝕨(≥⟜-∧<)s
+ 𝕨↩𝕨+s×𝕨<0
+ (⥊𝕩)⊑˜0(⊑⟜𝕨+⊑⟜s×⊢)´-↕⊸¬≠𝕨
+}
+Pickd←(∨´∘⥊IsArray¨∘⊣)◶Pick1‿{Pickd⟜𝕩¨𝕨}
+Pick←IsArray◶⥊‿⊢⊸Pickd
+⊑ ↩ (0¨∘≢)⊸Pick ⊘ Pick
+◶ ↩ {𝕨((𝕨𝔽𝕩)⊑𝕘){𝔽}𝕩} # Same definition, new Pick
+
# Searching
IndexOf←{
c←1-˜=𝕨