aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarshall Lochbaum <mwlochbaum@gmail.com>2020-10-02 13:59:20 -0400
committerMarshall Lochbaum <mwlochbaum@gmail.com>2020-10-02 13:59:20 -0400
commitcac51b1a0e524f01b22458a6cec9ac3740aeee99 (patch)
tree669506af86f66ec7670ae3074b1365ac8750ec04
parent0e251f26bef84a3e861bd2eca44c54ad92a6c55c (diff)
Simpler FindPairs implementation
-rw-r--r--md.bqn2
1 files changed, 1 insertions, 1 deletions
diff --git a/md.bqn b/md.bqn
index f77deea1..0bfd95ea 100644
--- a/md.bqn
+++ b/md.bqn
@@ -366,7 +366,7 @@ Markdown ← {filename𝕊𝕩:
# Find matched-depth [] and () pairs, then join adjacent ones
brak ← (unused ∧ 𝕩⊸=)¨ 2‿2⥊"[]()"
depth ← (+`-0⌊⊢)∘(-´)˘ brak
- FindPairs ← ∘‿2 ⥊ 1⊸⊏ /˜ 2⊸⊏ (≠∧0≤⊢) ((1-˜+˜+»)∞⊸«⊸=)∘⊏
+ FindPairs ← ∘‿2 ⥊ 1⊸⊏ /˜ 2⊸⊏ (<∨∧⟜») ·∞⊸«⊸=⊏
pairs ← depth <∘(FindPairs⍟(0<≠))∘⍉∘(∧(⊏˜≍˘⊢)⟜∾∾˘·/≠¨∘⊢)˘ /¨brak
JoinPairs ← {
e←1+1⊏˘𝕨 ⋄ b←⊏˘𝕩 ⋄ m←(≠b)>i←b⊐e