aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarshall Lochbaum <mwlochbaum@gmail.com>2020-07-29 18:08:24 -0400
committerMarshall Lochbaum <mwlochbaum@gmail.com>2020-07-29 18:08:24 -0400
commit1461cb3b0dcf4991295ecffa7317ae0c4a7a909c (patch)
tree7e04a6b27849fd5e56fbd259227157768d320ba2
parent48d8cc1401e46b8c33330f0f61fd36b40c20b789 (diff)
Don't include undefined built-in guards in preprocessing
-rwxr-xr-xdzref16
-rwxr-xr-xdzref_full20
-rw-r--r--impl.bqn6
-rwxr-xr-xtest/cmpref.bqn22
4 files changed, 26 insertions, 38 deletions
diff --git a/dzref b/dzref
index 26a4891a..03c14965 100755
--- a/dzref
+++ b/dzref
@@ -150,23 +150,19 @@ X←Raw←{≤4}
post ← ∾⟜" "¨/⟜"_"¨nc/0‿0‿1
names ← init∾¨(•UCS 48)∾¨post
- Inc ← {
+ Inc ← {
i←⊑chr⊐𝕩
n←0 ⋄ itr↩{n↩1+𝕩}⌾(i⊑⊢)itr
names↩((i⊑init)∾(•UCS 48+n)∾i⊑post)⌾(i⊑⊢)names
}
- # starting built-ins
- inps←⟨"𝕨 ","𝕨,𝕗","𝕨,𝕘"⟩
- ⍎¨names∾¨(nc/("←{⟨"∾∾⟜"⟩ ⋄ ⍎""Using undefined built-in ")¨inps)∾¨∾⟜"""}"¨chr
-
# built-in assumptions
- Mod ← ⍎{𝔽 ((⊑chr⊐𝕨)⊑names) ∾ " ↩ " ∾ 𝕩}
-
- ⍎"IsArray ← 0≠≡"
+ Mod ← {((⊑chr⊐𝕨)⊑names) ∾ " ← " ∾ 𝕩}
- '!' Mod "{𝕩 ⋄ ≤1}⍟¬"
- Mod⟜⥊¨ "↕∾⌽⊐⍋⍒"
+ ⍎¨ ⟨
+ "IsArray ← 0≠≡"
+ '!' Mod "{𝕩 ⋄ ≤1}⍟¬"
+ ⟩∾Mod⟜⥊¨ "↕∾⌽⊐⍋⍒"
# checks if line is a builtin redefinition
diff --git a/dzref_full b/dzref_full
index cccbc58e..bf558568 100755
--- a/dzref_full
+++ b/dzref_full
@@ -22,25 +22,21 @@ X←Raw←{≤4}
post ← ∾⟜" "¨/⟜"_"¨nc/0‿0‿1
names ← init∾¨(•UCS 48)∾¨post
- Inc ← {
+ Inc ← {
i←⊑chr⊐𝕩
n←0 ⋄ itr↩{n↩1+𝕩}⌾(i⊑⊢)itr
names↩((i⊑init)∾(•UCS 48+n)∾i⊑post)⌾(i⊑⊢)names
}
- # starting built-ins
- inps←⟨"𝕨 ","𝕨,𝕗","𝕨,𝕘"⟩
- ⍎¨names∾¨(nc/("←{⟨"∾∾⟜"⟩ ⋄ ⍎""Using undefined built-in ")¨inps)∾¨∾⟜"""}"¨chr
-
# built-in assumptions
- Mod ← ⍎{𝔽 ((⊑chr⊐𝕨)⊑names) ∾ " ↩ " ∾ 𝕩}
-
- ⍎"IsArray ← 0≠≡"
- ⍎"_amend ← {𝕨{𝕩⋄𝕗}⌾(𝕗⊑⊢)𝕩}"
- ⍎"Type ← ⟨⟩⥊0⊸⥊"
+ Mod ← {((⊑chr⊐𝕨)⊑names) ∾ " ← " ∾ 𝕩}
- '!' Mod "{𝕩 ⋄ ≤1}⍟¬"
- Mod⟜⥊¨ "+-×÷⋆⌊=≤≢⥊⊑↕⌜⁼"
+ ⍎¨ ⟨
+ "IsArray ← 0≠≡"
+ "_amend ← {𝕨{𝕩⋄𝕗}⌾(𝕗⊑⊢)𝕩}"
+ "Type ← ⟨⟩⥊0⊸⥊"
+ '!' Mod "{𝕩 ⋄ ≤1}⍟¬"
+ ⟩∾Mod⟜⥊¨ "+-×÷⋆⌊=≤≢⥊⊑↕⌜⁼"
# checks if line is a builtin redefinition
diff --git a/impl.bqn b/impl.bqn
index 11b9f3c9..f03d5c39 100644
--- a/impl.bqn
+++ b/impl.bqn
@@ -383,13 +383,13 @@ _bins←{
(≠𝕨) {B⟜𝕩 _binSearch 𝕨}¨ (×´sx) × ⥊⟜(↕×´)⊑⟜(≢𝕩)¨↕cx
}
-OccurrenceCount ← ⊐˜(⊢-⊏)⍋∘⍋
-ProgressiveIndexOf ← {𝕨⊐○(≍˘⟜OccurrenceCount𝕨⊸⊐)𝕩}
-
⍋ ← Cmp _grade ⊘ ( Cmp _bins)
⍒ ← -∘Cmp _grade ⊘ (-∘Cmp _bins)
∧ ↩ ⍋⊸⊏ ⊘ ∧
∨ ↩ ⍒⊸⊏ ⊘ ∨
+
+OccurrenceCount ← ⊐˜(⊢-⊏)⍋∘⍋
+ProgressiveIndexOf ← {𝕨⊐○(≍˘⟜OccurrenceCount𝕨⊸⊐)𝕩}
⊒ ← OccurrenceCount⊘ ProgressiveIndexOf
_repeat_←{
diff --git a/test/cmpref.bqn b/test/cmpref.bqn
index 54b3eabd..fb02a664 100755
--- a/test/cmpref.bqn
+++ b/test/cmpref.bqn
@@ -19,25 +19,21 @@ init ← " "⊸∾¨(/⟜"_"¨nc/0‿1‿1)∾¨(nc/"FMD")∾¨(nc+´⊸↑⥊"A
post ← ∾⟜" "¨/⟜"_"¨nc/0‿0‿1
names ← init∾¨(•UCS 48)∾¨post
-Inc ← {
+Inc ← {
i←⊑chr⊐𝕩
n←0 ⋄ itr↩{n↩1+𝕩}⌾(i⊑⊢)itr
names↩((i⊑init)∾(•UCS 48+n)∾i⊑post)⌾(i⊑⊢)names
}
-# starting built-ins
-inps←⟨"𝕨 ","𝕨,𝕗","𝕨,𝕘"⟩
-pre ← names∾¨(nc/("←{⟨"∾∾⟜"⟩ ⋄ ≤""Using undefined built-in ")¨inps)∾¨∾⟜"""}"¨chr
-
# built-in assumptions
-Mod ← {pre ∾↩ <((⊑chr⊐𝕨)⊑names) ∾ " ↩ " ∾ 𝕩}
-
-pre ∾↩ <"IsArray ← 0≠≡"
-pre ∾↩ <"_amend ← {𝕨{𝕩⋄𝕗}⌾(𝕗⊑⊢)𝕩}"
-pre ∾↩ <"Type ← ⟨⟩⥊0⊸⥊"
-
-'!' Mod "{𝕩 ⋄ ≤1}⍟¬"
-Mod⟜⥊¨ "+-×÷⋆⌊=≤≢⥊⊑↕⌜⁼"
+Mod ← {((⊑chr⊐𝕨)⊑names) ∾ " ← " ∾ 𝕩}
+
+pre ← ⟨
+ "IsArray ← 0≠≡"
+ "_amend ← {𝕨{𝕩⋄𝕗}⌾(𝕗⊑⊢)𝕩}"
+ "Type ← ⟨⟩⥊0⊸⥊"
+ '!' Mod "{𝕩 ⋄ ≤1}⍟¬"
+⟩∾Mod⟜⥊¨ "+-×÷⋆⌊=≤≢⥊⊑↕⌜⁼"
# checks if line is a builtin redefinition