aboutsummaryrefslogtreecommitdiff
path: root/impl.bqn
diff options
context:
space:
mode:
authorMarshall Lochbaum <mwlochbaum@gmail.com>2020-07-31 13:23:54 -0400
committerMarshall Lochbaum <mwlochbaum@gmail.com>2020-07-31 13:24:48 -0400
commite4634b49f32a8040eb1113f7c5f470aec20d8bb6 (patch)
tree770bbf213d4aeba8dae998343b2523282c833b1a /impl.bqn
parent1a15fa1cb984dd1d6bd3f5c5b56e0169b1085edf (diff)
Lookup-based ⁼ implementation
Diffstat (limited to 'impl.bqn')
-rw-r--r--impl.bqn14
1 files changed, 14 insertions, 0 deletions
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