aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rwxr-xr-xsrc/pr.bqn17
1 files changed, 11 insertions, 6 deletions
diff --git a/src/pr.bqn b/src/pr.bqn
index 9e7db7e7..fd241395 100755
--- a/src/pr.bqn
+++ b/src/pr.bqn
@@ -13,14 +13,16 @@ nc ← ≠¨chrs
glyphs ⇐ chr ← ∾chrs
itr ← 0⥊˜≠chr
+idChars ← "_¯.π∞"∾∾"0aA"+⟜↕¨10‿26‿26
+
init ← " "⊸∾¨(/⟜"_"¨nc/0‿1‿1)∾¨(nc/"FMD")∾¨(nc+´⊸↑⥊"ABC"∾⌜•a)
post ← ∾⟜" "¨/⟜"_"¨nc/0‿0‿1
-names ← init∾¨'0'∾¨post
+out ← init∾¨'0'∾¨post
Inc ← {
i←⊑chr⊐𝕩
n←0 ⋄ itr↩{n↩1+𝕩}⌾(i⊑⊢)itr
- names↩((i⊑init)∾('0'+n)∾i⊑post)⌾(i⊑⊢)names
+ out↩((i⊑init)∾('0'+n)∾i⊑post)⌾(i⊑⊢)out
}
# Required functionality passed in as an argument
@@ -31,13 +33,16 @@ ki ← chr⊐keep
dt ← ⊔⟜⊒ (+´·∧`'_'=0‿¯1⊸⊏)¨ def
ns ← » ne←+`nc
kt ← ∾ (ns+≠¨dt) + ⊔⟜⊒ne⍋ki
-names ↩ (⥊¨kt⊏chr)⌾(ki⊸⊏)names
+
+chrt ← ⥊¨chr
+in ← chrt ∾ def
+out ↩ ((kt⊏chrt)⌾(ki⊸⊏)out) ∾ (∾ns+dt)⊏chrt
E_isdef ← (3≤≠)◶⟨0,∧´⟨chr," ","←↩"⟩∊˜¨3⊸↑⟩
-E_proc ← ({𝕨∘𝕩}´ def {𝕨•_R_𝕩}⟜⥊¨ chr⊏˜∾ns+dt)∘{
- l←≠chr
+E_proc ← {
q←≠`𝕩='"' ⋄ q∨↩≠`q<𝕩=''' ⋄ f←¬∨`q<𝕩='#'
- ∾ (((l×f/q)+chr⊸⊐) (≥⟜l)◶⟨⊑⟜names,⥊∘⊢⟩¨ ⊢) f/𝕩
+ t ← (¯1+`·¬(»f/q)∨·»⊸∧∊⟜idChars)⊸⊔ f/𝕩
+ ∾ (in⊸⊐ ⊑⟜out⍟(<⟜(≠in))¨ ⊢) t
}
E_redef ← { # handles [fmd] [←↩]
tail ← E_proc 3↓𝕩 # must use old def