aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMarshall Lochbaum <mwlochbaum@gmail.com>2021-03-25 20:50:53 -0400
committerMarshall Lochbaum <mwlochbaum@gmail.com>2021-03-25 20:50:53 -0400
commitec98071c058e68ab9f3eb62378cad09d05871ee5 (patch)
tree408c9c3d2ad9e6a7ab1a473a1a370cf7b31346ea /src
parenta24022232647b8971cba425683f278f7befcf43f (diff)
Return a setter for Decompose and Glyph from the runtime so they don't have to be defined mutably
Diffstat (limited to 'src')
-rwxr-xr-xsrc/pr.bqn4
-rw-r--r--src/r.bqn10
2 files changed, 8 insertions, 6 deletions
diff --git a/src/pr.bqn b/src/pr.bqn
index 6e2244b9..c9e13954 100755
--- a/src/pr.bqn
+++ b/src/pr.bqn
@@ -11,7 +11,7 @@ chrs←⟨
glyphs ⇐ ∾chrs
# Provided values, to be passed in through the constants array
-def ← ⟨"Type","Decompose","Glyph","Fill","Log","GroupLen","GroupOrd","_fillBy_"⟩
+def ← ⟨"Type","Fill","Log","GroupLen","GroupOrd","_fillBy_"⟩
keep ← "!+-×÷⋆⌊=≤≢⥊⊑↕⌜`⊘"
len ⇐ def+○≠keep
@@ -27,4 +27,4 @@ GetRepls ← {
⟨E_proc⟩ ← chrs‿GetRepls •Import "pp.bqn"
rslt ← "⟨"∾"⟩"«∾","⊸∾¨glyphs # Output all primitives
-ref ⇐ ∾∾⟜(@+10)¨ E_proc¨ (•FLines "r.bqn")∾<rslt
+ref ⇐ ∾∾⟜(@+10)¨ E_proc¨ (•FLines "r.bqn")∾<rslt∾"‿SetPrims"
diff --git a/src/r.bqn b/src/r.bqn
index 84adec0c..a2af82bb 100644
--- a/src/r.bqn
+++ b/src/r.bqn
@@ -1,7 +1,9 @@
# BQN runtime. Requires:
-# Type Decompose Glyph Fill Log GroupLen GroupOrd _fillBy_
+# Type Fill Log GroupLen GroupOrd _fillBy_
# !+-×÷⋆⌊=≤≢⥊⊑↕⌜`⊘
-Glyph
+Decompose ← {0‿𝕩}
+Glyph ← {𝕩⋄!0}
+SetPrims ← {Decompose‿Glyph ↩ 𝕩}
◶ ← {𝕨((𝕨𝔽𝕩)⊑𝕘){𝔽}𝕩} # LIMITED to number left operand result
⊢ ← {𝕩}
@@ -779,7 +781,7 @@ Mod1Inverse ← INF˙ _lookup_ ⟨
⟩ {
0⊸⊑ {𝕏𝕨}⟜𝔽 1⊸⊑
}
-IsConstant ← (3≤Type)◶⟨1 ⋄ 4‿˙ ≡ 0‿¯1⊏Decompose⟩
+IsConstant ← (3≤Type)◶⟨1 ⋄ 4‿˙ ≡ 0‿¯1⊏{Decompose𝕩}⟩
Mod2Inverse ← INF˙ _lookup_ ⟨
_inv_, {𝕏_inv_𝕎}
∘, AtopInverse
@@ -804,7 +806,7 @@ FuncInverse ← (⊑ ⊣◶⟨
TrainInverse # 3-train
Mod1Inverse # 4 1-modifier
Mod2Inverse # 5 2-modifier
-⟩ 1⊸↓) Decompose
+⟩ 1⊸↓) {Decompose𝕩}
Inverse ← Type◶(3‿1‿2/{⊢⊣𝕩IX∘≡⊢}‿FuncInverse‿("Cannot invert modifier"!0˙))
⁼ ↩ {𝕗 (≢∧INF˙⊸≢)◶0‿(5‿_inv_≢0‿¯2⊏Decompose∘⊢)◶⊢‿{𝕏_inv_(𝕎_invChk_𝕏)} Inverse 𝕗}