From d784a9cfb449b4dd9878713f6eb12a814142765f Mon Sep 17 00:00:00 2001 From: Marshall Lochbaum Date: Sun, 13 Sep 2020 15:25:08 -0400 Subject: =?UTF-8?q?Add=20monadic=20=C2=AB=C2=BB=20to=20dzref?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dzref | 4 ++-- md.bqn | 20 ++++++++++---------- 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 (⊑⟨"\"," ",""⟩⊐ 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⊸«⊸ (/start) {𝕨⊸+⌾(1⊸⊑)𝕩}⟜GetHighlights¨ ⊢) groups } -- cgit v1.2.3