From e4634b49f32a8040eb1113f7c5f470aec20d8bb6 Mon Sep 17 00:00:00 2001 From: Marshall Lochbaum Date: Fri, 31 Jul 2020 13:23:54 -0400 Subject: =?UTF-8?q?Lookup-based=20=E2=81=BC=20implementation?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dzref_full | 3 ++- impl.bqn | 14 ++++++++++++++ test/cmpref.bqn | 3 ++- 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/dzref_full b/dzref_full index 3edbb93d..b6e9e517 100755 --- a/dzref_full +++ b/dzref_full @@ -35,8 +35,9 @@ X←Raw←{≤4} "IsArray ← 0≠≡" "_amend ← {𝕨{𝕩⋄𝕗}⌾(𝕗⊑⊢)𝕩}" "Type ← ⟨⟩⥊0⊸⥊" + "Log ← ⋆⁼" '!' Mod "{𝕩 ⋄ ≤1}⍟¬" - ⟩∾Mod⟜⥊¨ "+-×÷⋆⌊=≤≢⥊⊑↕⌜⁼" + ⟩∾Mod⟜⥊¨ "+-×÷⋆⌊=≤≢⥊⊑↕⌜" # checks if line is a builtin redefinition diff --git a/impl.bqn b/impl.bqn index 026c03f3..558ef06b 100644 --- a/impl.bqn +++ b/impl.bqn @@ -392,6 +392,20 @@ OccurrenceCount ← ⊐˜(⊢-⊏)⍋∘⍋ ProgressiveIndexOf ← {𝕨⊐○(≍˘⟜OccurrenceCount𝕨⊸⊐)𝕩} ⊒ ← OccurrenceCount⊘ ProgressiveIndexOf +inverse ← {(⊑(0⊏𝕩)⊐<) ⊑ ((1⊏𝕩)∾⟨!∘0⟩)˜} ⍉ (2∾˜2÷˜≠)⊸⥊ ⟨ + +, +⊘(-˜) + -, - + ×, ⊢⊘(÷˜) + ÷, ÷ + ⋆, Log + √, ⋆⟜2⊘(⋆˜) + ∧, ⊢⊘(÷˜) + ∨, ⊢⊘(-˜÷1-⊢) + <, {!IsArray𝕩⋄!0==𝕩⋄⊑𝕩}⊘(!∘0) + /, {!(⍋≡↕∘≠)𝕩⋄≠¨⊔𝕩}⊘(!∘0) +⟩ +⁼ ← {Inverse 𝕗} + _repeat_←{ n←𝕨𝔾𝕩 l←u←0 diff --git a/test/cmpref.bqn b/test/cmpref.bqn index 8186889a..86788f81 100755 --- a/test/cmpref.bqn +++ b/test/cmpref.bqn @@ -32,8 +32,9 @@ pre ← ⟨ "IsArray ← 0≠≡" "_amend ← {𝕨{𝕩⋄𝕗}⌾(𝕗⊑⊢)𝕩}" "Type ← ⟨⟩⥊0⊸⥊" + "Log ← ⋆⁼" '!' Mod "{𝕩 ⋄ ≤1}⍟¬" -⟩∾Mod⟜⥊¨ "+-×÷⋆⌊=≤≢⥊⊑↕⌜⁼" +⟩∾Mod⟜⥊¨ "+-×÷⋆⌊=≤≢⥊⊑↕⌜" # checks if line is a builtin redefinition -- cgit v1.2.3