aboutsummaryrefslogtreecommitdiff
path: root/spec/dzref
diff options
context:
space:
mode:
authorMarshall Lochbaum <mwlochbaum@gmail.com>2020-06-29 20:37:51 -0400
committerMarshall Lochbaum <mwlochbaum@gmail.com>2020-06-29 20:37:51 -0400
commit5cfbc5909bd33b5927f7b1fdb44944819563a385 (patch)
tree2a1f64203e0f92647c426833c5d4292146cef885 /spec/dzref
parent4eeb808545e8dd7ba3a8e0f89af3c875fce88af4 (diff)
Layer 3 tests
Diffstat (limited to 'spec/dzref')
-rwxr-xr-xspec/dzref26
1 files changed, 6 insertions, 20 deletions
diff --git a/spec/dzref b/spec/dzref
index 8c41eba4..997e5d58 100755
--- a/spec/dzref
+++ b/spec/dzref
@@ -1,6 +1,7 @@
#!/usr/bin/env dbqn
-impl ← "√ ← ⋆⟜(÷2) ⊘ (⋆⟜÷˜)
+impl ← "◶ ← {𝕨((𝕨𝔽𝕩)⊑𝕘){𝔽}𝕩}
+√ ← ⋆⟜(÷2) ⊘ (⋆⟜÷˜)
∧ ← ×
∨ ← (+-×)
> ← (¬≤)
@@ -64,12 +65,6 @@ _perv←{ ⍝ Pervasion
Int←IsArray◶⟨⌊⊸=,0⟩
Nat←IsArray◶⟨0⊸≤∧⌊⊸=,0⟩
-Range←{
- I←{!Nat𝕩⋄↕𝕩}
- M←{!1=≠≢𝕩⋄(<⟨⟩)⥊⊸∾⌜´I¨𝕩}
- IsArray◶I‿M 𝕩
-}
-
Pick1←{
! 1=≠≢𝕨
! 𝕨=○≠s←≢𝕩
@@ -78,23 +73,13 @@ Pick1←{
𝕨↩𝕨+s×𝕨<0
(⥊𝕩)⊑˜0(⊑⟜𝕨+⊑⟜s×⊢)´-↕⊸¬≠𝕨
}
-Pickd←(0∨´IsArray¨∘⊣)◶Pick1‿{Pickd⟜𝕩¨𝕨}
+Pickd←(0∨´⟜⥊IsArray¨∘⊣)◶Pick1‿{Pickd⟜𝕩¨𝕨}
Pick←IsArray◶⥊‿⊢⊸Pickd
-match←{¬∘(0⊑𝕨)◶(1⊑𝕨)‿𝕩}´⟨
- ⟨≠○IsArray , 0⟩
- ⟨¬IsArray∘⊢, =⟩
- ⟨≠○(≠≢) , 0⟩
- ⟨0∨´≠○≢ , 0⟩
- {∧´⥊𝕨Match¨𝕩}
-⟩
-
Depth←IsArray◶0‿{1+0⌈´Depth¨⥊𝕩}
⊑ ↩ (0¨∘≢)⊸Pick ⊘ Pick
-↕ ↩ Range
-
-≡ ← Depth ⊘ Match
+≡ ← Depth ⊘ ≡
⍝⌜
@@ -336,7 +321,7 @@ ProgressiveIndexOf ← {𝕨⊐○(≍˘⟜OccurrenceCount𝕨⊸⊐)𝕩}
names ← ⥊"AB"∾⌜•a
f_chr ← "!√∧∨|>≡∾≍↑↓↕⌽⍉/⍋⍒⊏⊑⊐⊒∊⍷⊔"
m_chr ← "˘¨⌜´`"
- d_chr ← "⌾⎉⚇⍟"
+ d_chr ← "⌾⎉⚇⍟◶"
f_itr ← 0⥊˜≠f_chr
m_itr ← 0⥊˜≠m_chr
@@ -373,6 +358,7 @@ ProgressiveIndexOf ← {𝕨⊐○(≍˘⟜OccurrenceCount𝕨⊸⊐)𝕩}
'!' Mod_f "{𝕩 ⋄ ≤1}⍟¬"
'⊑' Mod_f "⊑"
'↕' Mod_f "↕"
+ '≡' Mod_f "≡"
E_isdef ← ⊢ ≢ ("^["∾f_chr∾m_chr∾d_chr∾"] [←↩]")•_R_'_' ⍝ checks if line is a builtin redefinition