aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMarshall Lochbaum <mwlochbaum@gmail.com>2021-03-26 09:32:25 -0400
committerMarshall Lochbaum <mwlochbaum@gmail.com>2021-03-26 09:32:25 -0400
commit3fbc09952ed3db5a329195c742865732537e7664 (patch)
tree7be8898a8b297f4f5aa4d5beef93d57d8c95062e /src
parent796d15378aee570675b4d0c34dd5b06c98e013dd (diff)
Define a default PrimInd from pr.bqn
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 c9e13954..27e9a211 100755
--- a/src/pr.bqn
+++ b/src/pr.bqn
@@ -26,5 +26,7 @@ GetRepls ← {
⟨E_proc⟩ ← chrs‿GetRepls •Import "pp.bqn"
+gd ← "glyphs←"""∾glyphs∾"%"""
rslt ← "⟨"∾"⟩"«∾","⊸∾¨glyphs # Output all primitives
-ref ⇐ ∾∾⟜(@+10)¨ E_proc¨ (•FLines "r.bqn")∾<rslt∾"‿SetPrims"
+src ← ∾⟨⟨gd⟩,•FLines"r.bqn",⟨"{PrimInd↩⊑𝕩⊐<⋄𝕩‿SetPrims}"∾rslt⟩⟩
+ref ⇐ ∾∾⟜(@+10)¨ E_proc¨ src
diff --git a/src/r.bqn b/src/r.bqn
index e64ee27e..d19f1756 100644
--- a/src/r.bqn
+++ b/src/r.bqn
@@ -1,8 +1,9 @@
# BQN runtime. Requires:
-# Type Fill Log GroupLen GroupOrd _fillBy_
-# !+-×÷⋆⌊=≤≢⥊⊑↕⌜`⊘
+# Type Fill Log GroupLen GroupOrd _fillBy_
+# !+-×÷⋆⌊=≤≢⥊⊑↕⌜`⊘
+# Filled in by runtime: glyphs and default PrimInd
Decompose ← {0‿𝕩}
-PrimInd ← {𝕩⋄!0}
+PrimInd ← {𝕩}
SetPrims ← {Decompose‿PrimInd ↩ 𝕩}
◶ ← {𝕨((𝕨𝔽𝕩)⊑𝕘){𝔽}𝕩} # LIMITED to number left operand result
@@ -43,8 +44,7 @@ _fold←{
´ ← _fold
_glyphLookup_ ← {
- g←"+-×÷⋆√⌊⌈|¬∧∨<>≠=≤≥≡≢⊣⊢⥊∾≍↑↓↕«»⌽⍉/⍋⍒⊏⊑⊐⊒∊⍷⊔!˙˜˘¨⌜⁼´˝`∘○⊸⟜⌾⊘◶⎉⚇⍟%"
- {PrimInd𝕩} ⊑ ((𝕘⊑˜·+´·×`𝕗(1-=)⌜<)⌜g)˙
+ {PrimInd𝕩} ⊑ ((𝕘⊑˜·+´·×`𝕗(1-=)⌜<)⌜glyphs)˙
}
Cell←{(𝕨⊸+⊑𝕩˙)⌜↕(≠𝕩)-𝕨}⟜≢