aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarshall Lochbaum <mwlochbaum@gmail.com>2020-07-31 10:47:53 -0400
committerMarshall Lochbaum <mwlochbaum@gmail.com>2020-07-31 10:47:53 -0400
commit1a15fa1cb984dd1d6bd3f5c5b56e0169b1085edf (patch)
treecb57cee8bdf8f9e8bcfb5617c400a8630c0f2784
parent0d13401bde67f9e8106d8189eec2edb9662d4436 (diff)
Use dyadic inverse instead of inverting a train
-rwxr-xr-xc.bqn2
-rwxr-xr-xdzref_full2
-rw-r--r--impl.bqn6
-rwxr-xr-xtest/cmpref.bqn2
4 files changed, 6 insertions, 6 deletions
diff --git a/c.bqn b/c.bqn
index 45286af3..23833a01 100755
--- a/c.bqn
+++ b/c.bqn
@@ -193,7 +193,7 @@ DParse ← {nv‿r𝕊𝕩:
or←⍋idor∾g⊏˜∾⟨cn,cn,b,b,rt,dr,l,l,si,si,at,oa+1⌈oa⊏os,(dy×⊏⟜os)⊸+fa+dy⟩
bc0←∾idbc∾⟨0¨cn,u⊐ob,15¨b,1+↕≠b⟩
- bc←or⊏bc0∾∾⟨25¨rt,14¨dr,3+l⊏aa,ll,3+si⊏aa,sll,(11-⊑bG)+a/ma+𝕩,5+oa⊏r,16+dy-7×fa⊏tr⟩
+ bc←or⊏bc0∾∾⟨25¨rt,14¨dr,3+l⊏aa,ll,3+si⊏aa,sll,(11-⊑bG)+a/ma+𝕩,5+oa⊏r,(⊢+9×10⊸=)16+dy-7×fa⊏tr⟩
fs←(ft⊏⥊"fmd"≍⌜⌽↕2)∾¨((+`0∾1+⌊128⋆⁼1⌈bc)⊏˜/1∾or∊bc0+⟜↕○≠rt)≍○<¨(ft⊏spd)∾⟜(⥊¨↑⟜•a)¨lc
⟨LEBv bc,u,fs⟩
}
diff --git a/dzref_full b/dzref_full
index bf558568..3edbb93d 100755
--- a/dzref_full
+++ b/dzref_full
@@ -10,7 +10,7 @@ impl ← •LNS "impl.bqn"
X←Raw←{≤4}
{
chrs←⟨
- "!+-×÷⋆√⌊⌈∧∨¬|=≠≤<>≥≡≢⊣⥊∾≍↑↓↕⌽⍉/⍋⍒⊏⊑⊐⊒∊⍷⊔"
+ "!+-×÷⋆√⌊⌈∧∨¬|=≠≤<>≥≡≢⊣⊢⥊∾≍↑↓↕⌽⍉/⍋⍒⊏⊑⊐⊒∊⍷⊔"
"˜˘¨⌜⁼´˝`"
"∘⊸⟜○⌾⎉⚇⍟◶⊘"
diff --git a/impl.bqn b/impl.bqn
index f03d5c39..026c03f3 100644
--- a/impl.bqn
+++ b/impl.bqn
@@ -1,6 +1,6 @@
◶ ← {𝕨((𝕨𝔽𝕩)⊑𝕘){𝔽}𝕩} # LIMITED to number left operand result
⊘ ← {𝕨((1{𝔽}𝕨)-0)◶𝔽‿𝔾 𝕩}
-#⊢ ← {𝕩} # Prevents dyadic negative ⍟
+⊢ ← {𝕩}
⊣ ← {𝕩}⊘{𝕨}
˜ ← {𝕩𝔽𝕨⊣𝕩}
∘ ← {𝔽𝕨𝔾𝕩}
@@ -394,11 +394,11 @@ ProgressiveIndexOf ← {𝕨⊐○(≍˘⟜OccurrenceCount𝕨⊸⊐)𝕩}
_repeat_←{
n←𝕨𝔾𝕩
- f←0⊑𝕨⟨𝔽⟩⊘⟨𝕨𝔽⊢⟩𝕩
l←u←0
{!Int𝕩⋄l↩l⌊𝕩⋄u↩u⌈𝕩}⚇0 n
a←𝕩⋄_p←{𝔽∘⊣`(1+𝕩)⥊<a}
- pos←F _p u ⋄ neg←F⁼_p-l
+ pos←(𝕨𝔽 ⊢)_p u
+ neg←(𝕨𝔽⁼⊢)_p-l
(|⊑<⟜0⊑pos‿neg˜)⚇0 n
}
⍟ ↩ _repeat_
diff --git a/test/cmpref.bqn b/test/cmpref.bqn
index 029af28c..8186889a 100755
--- a/test/cmpref.bqn
+++ b/test/cmpref.bqn
@@ -7,7 +7,7 @@ impl ← •LNS •path∾"../impl.bqn"
drun ← ((<•path∾"../c.bqn")∾<"DRun") •EX •path∾"../dzref"
chrs←⟨
- "!+-×÷⋆√⌊⌈∧∨¬|=≠≤<>≥≡≢⊣⥊∾≍↑↓↕⌽⍉/⍋⍒⊏⊑⊐⊒∊⍷⊔"
+ "!+-×÷⋆√⌊⌈∧∨¬|=≠≤<>≥≡≢⊣⊢⥊∾≍↑↓↕⌽⍉/⍋⍒⊏⊑⊐⊒∊⍷⊔"
"˜˘¨⌜⁼´˝`"
"∘⊸⟜○⌾⎉⚇⍟◶⊘"