aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarshall Lochbaum <mwlochbaum@gmail.com>2020-09-06 10:51:56 -0400
committerMarshall Lochbaum <mwlochbaum@gmail.com>2020-09-06 10:51:56 -0400
commit4fa91c4a662c8cb1f1efe631610b944381e12457 (patch)
treea90d042026929f2665e4d5098051297b4cf2bab2
parent2a95b07d3c6ce62d6c3e92d1a2e54a2a1799a79c (diff)
Faster ∊⟜Ranges implementation
-rw-r--r--md.bqn7
1 files changed, 6 insertions, 1 deletions
diff --git a/md.bqn b/md.bqn
index 1698bf22..f8ab861f 100644
--- a/md.bqn
+++ b/md.bqn
@@ -101,6 +101,11 @@ Ranges ← {
𝕩 ↩ βˆ˜β€Ώ2 β₯Š 𝕩 # Reshape into pairs
∾ R¨˝˘ 𝕩
}
+# ∊⟜Ranges assuming 𝕨 is sorted
+InRanges ← {
+ 𝕩 +↩ 2|↕≠𝕩 # Since ⍋ works with half-open intervals
+ 2 | 𝕩 ⍋ 𝕨
+}
# Create an html node from a tag name and interior text.
Html ← {open π•Š contents:
@@ -302,7 +307,7 @@ Markdown ← {filenameπ•Šπ•©:
# Inline elements
ProcInline ← {
I2M ← (≠𝕩) ↑ /⁼ # Index to mask
- punc ← 𝕩 ∊ Ranges "!/:@[`{~"
+ punc ← 𝕩 InRanges "!/:@[`{~"
actual ← Β¬ punc ∧ IsEscaped 𝕩 # backtick or *actual* backtick?
# Code spans