aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xdzref4
-rw-r--r--md.bqn20
2 files changed, 12 insertions, 12 deletions
diff --git a/dzref b/dzref
index a8e47626..aeea29f4 100755
--- a/dzref
+++ b/dzref
@@ -1,8 +1,8 @@
#!/usr/bin/env dbqn
impl ← "
-» ← {!𝕨1⊸⌊⊸≤○=𝕩 ⋄ ( ≠𝕩)↑𝕨∾𝕩}
-« ← {!𝕨1⊸⌊⊸≤○=𝕩 ⋄ (-≠𝕩)↑𝕩∾𝕨}
+» ← {!1≤=𝕩 ⋄ ( ≠𝕩)↑(1↑0↑𝕩)∾𝕩} ⊘ {!𝕨1⊸⌊⊸≤○=𝕩 ⋄ ( ≠𝕩)↑𝕨∾𝕩}
+« ← {!1≤=𝕩 ⋄ (-≠𝕩)↑𝕩∾(1↑0↑𝕩)} ⊘ {!𝕨1⊸⌊⊸≤○=𝕩 ⋄ (-≠𝕩)↑𝕩∾𝕨}
#⌜
# LAYER 4: Operators
diff --git a/md.bqn b/md.bqn
index 3fdd087e..8faaa830 100644
--- a/md.bqn
+++ b/md.bqn
@@ -45,7 +45,7 @@ CountRuns ← { (1+↕≠𝕩) (⊣ - ⌈`∘×) ¬𝕩 }
# is, preceded by an odd number of backslashes (since a backslash can
# escape another backslash).
IsEscaped ← {
- 0 » 2 | CountRuns 𝕩 = '\'
+ » 2 | CountRuns 𝕩 = '\'
}
# Remove leading (∧`) and trailing (∧`⌾⌽) spaces
@@ -220,7 +220,7 @@ Markdown ← {filename𝕊𝕩:
𝕩 ↓˜↩ 𝕨+1
trsp ← ∧`⌾⌽ 𝕩=' '
tail ← ∧`⌾⌽ trsp∨𝕩='#' # Mask of trailing hashes
- f ← tail < 0 « tail # Character before trailing hashes
+ f ← <⟜« tail # Character before trailing hashes
𝕩 /˜↩ ¬ f (⊑⟨"\"," ",""⟩⊐<f/𝕩)◶⟨⊣,⊢,⊢,0¨⊢⟩ tail
# Add an id, containing only a-z, digits, and hyphens
Slugify ← {
@@ -251,7 +251,7 @@ Markdown ← {filename𝕊𝕩:
CutTableRow ← {
b ← '|' = 𝕩 # Mask of bars
o ← (¬b) ≠○Lead ' '=𝕩 # Leading | omitted
- r ← b > 0 » '\' = 𝕩 # Non-escaped bars
+ r ← b > » '\' = 𝕩 # Non-escaped bars
1 -˜ (¬r∨1⌽b>r) × o + +` r
}
ProcTable ← {
@@ -311,12 +311,12 @@ Markdown ← {filename𝕊𝕩:
# Code spans
tick ← 𝕩 = '`'
- tend ← / (⊢ > 0⊸«) tick
+ tend ← / >⟜« tick
tcount ← CountRuns tick
# 𝕨 are tick lengths and 𝕩 are positions, both sorted by length
MatchTicks ← {
# Tick runs other than the last of each length
- notLast ← (⊢=0⊸«) 𝕨
+ notLast ← =⟜« 𝕨
# Ticks preceded by backslashes can't start code blocks, but can
# end them. This approach is wrong for multiple ticks with a
# leading backslash in front, which are excluded but should just
@@ -363,7 +363,7 @@ Markdown ← {filename𝕊𝕩:
# Emphasis (still rudimentary)
eMasks ← (unused ∧ 𝕩⊸=)¨ "*_"
- eMasks ↩ 0⊸«⊸∧¨⊸(⊣∾˜0⊸»⊸∨⊸<¨) eMasks
+ eMasks ↩ «⊸∧¨⊸(⊣∾˜»⊸∨⊸<¨) eMasks
eInds ← (⊢-2|⊢)∘≠⊸↑∘/¨ eMasks
include ∧↩ ¬ I2M ∧ ∾ eInds∾1+2↓eInds
eInds ∾↩ ⟨codeBounds⟩
@@ -507,7 +507,7 @@ GetHighlights ← {
le← /(𝕩=lf)∾1
# Line endings (le) end every comment (/c) on the line, so take a copy
# for each # before that line but not the previous.
- ce← le /˜ -⟜(0⊸») c/⊸⍋le
+ ce← le /˜ -⟜» c/⊸⍋le
# A single quote can only be used if there's another two places down.
s ← /0‿0⊸«⊸∧𝕩='''
d ← /𝕩='"'
@@ -527,9 +527,9 @@ GetHighlights ← {
# Color numeric literals and identifiers
id ← col=5 # ←→ 𝕩∊idChars
- w ← 0⊸»⊸< id # Word (identifier or number) beginning mask
+ w ← »⊸< id # Word (identifier or number) beginning mask
wt ← idChars FindGroup w/𝕩 # Type based on first character
- wt+↩ '_' = (0⊸«⊸<id)/𝕩 # Modifier1 to Modifier2 based on word end
+ wt+↩ '_' = («⊸<id)/𝕩 # Modifier1 to Modifier2 based on word end
wt+↩ 5×0=wt # Shift 0 to Number
wi ← 1-˜+`id/w # Index of word containing each of /id
col↩(wi⊏wt)⌾(id⊸/) col
@@ -547,7 +547,7 @@ GetHighlights ← {
# Return highlights for areas in 𝕩 where 𝕨 is true.
GetMultiHighlights ← {
- start ← 0⊸»⊸< 𝕨
+ start ← »⊸< 𝕨
groups ← (1 -˜ 𝕨 × +` start) ⊔ 𝕩
<∘∾˘ ⍉ ((≠∾2˙) ⥊ ·> (/start) {𝕨⊸+⌾(1⊸⊑)𝕩}⟜GetHighlights¨ ⊢) groups
}