From 7bf2aa4054b8378a76dff63acdccbcdad91f68e6 Mon Sep 17 00:00:00 2001 From: Marshall Lochbaum Date: Sat, 7 Aug 2021 20:41:31 -0400 Subject: BREAKING: Don't allow First of empty or reshaping empty to non-empty --- test/cases/fill.bqn | 51 +++++++++++++++++++++++++-------------------------- test/cases/prim.bqn | 3 +++ 2 files changed, 28 insertions(+), 26 deletions(-) (limited to 'test') diff --git a/test/cases/fill.bqn b/test/cases/fill.bqn index 21603ca6..b03cb15d 100644 --- a/test/cases/fill.bqn +++ b/test/cases/fill.bqn @@ -1,11 +1,10 @@ # String fill -' ' ≡ ⊑"" +' ' ≡ ⊑1↑"" # Match doesn't use fills "ab" ≡○(0⊸↑) ↕2 # Functions that fill -" "≡5⥊"" ("abc"≍"de ") ≡ 2‿↑⥊"abcde" "abc "≡5↑"abc" " ab" ≡ »"abc" @@ -14,64 +13,64 @@ # Box generates arbitrary fill elements ∧´ (2⊸↑ ≡ 1‿0⊸×)∘<¨ ⟨π, ↕3, "", 2+⌜○↕3, ≍˘⟨2‿1,↕4‿2⟩⟩ (0¨ ≡ 1⊑2↑<) ∞‿¯∞‿0 -" "‿0 ≡ ⊑0⥊<"xy"‿¯π +" "‿0 ≡ ⊑»1⥊<"xy"‿¯π ⟨7⥊0‿' '⟩ ≡ »≍<'a'⍟(2⊸|)¨↕7 # Special cases -0 ≡ ⊑↕0 +0 ≡ ⊑1↑↕0 0‿1‿2‿0 ≡ 4↑↕3 -≡⟜(⊑↕) 0‿0‿0 +≡⟜(⊑1↑⥊∘↕) 0‿0‿0 (⥊⟜(<0⊸×) ≡ »∘↕) 1‿2 (4⊸↑ ≡ 0‿1‿2‿0⊸⊏) ↑↕2 (↑ ≡○(⊑¯7⊸↑) ↓) ≍˘⟨↕3,"ab"⟩ # Arithmetic -∧´{0‿0≡⊑0⥊𝕏↕2‿4}¨ +‿-‿×‿÷‿⋆‿√‿⌊‿⌈‿|‿¬ -∧´{(2⥊<0‿0)≡⊑0⥊⟨0‿1,23⟩𝕏○(3⥊<)⟨01,2‿3⟩}¨ +‿-‿×‿÷‿⋆‿√‿⌊‿⌈‿|‿¬‿∧‿∨ -∧´{(2⥊<0‿0)≡⊑0⥊⟨0‿'c',2‿'d'⟩𝕏○(3⥊<)⟨01,"ch"⟩}¨ <‿>‿≠‿=‿≤‿≥ -0‿' '‿' ' ≡ ⊑0⥊ 0‿1‿'c'+○<0‿'b'‿2 -0‿' '‿0 ≡ ⊑0⥊ 0‿'b'‿'c'-○<0‿1‿'c' +∧´{0‿0≡⊑»𝕏↕2‿4}¨ +‿-‿×‿÷‿⋆‿√‿⌊‿⌈‿|‿¬ +∧´{(2⥊<0‿0)≡⊑»⥊⟨0‿1,23⟩𝕏○(3⥊<)⟨01,2‿3⟩}¨ +‿-‿×‿÷‿⋆‿√‿⌊‿⌈‿|‿¬‿∧‿∨ +∧´{(2⥊<0‿0)≡⊑»⥊⟨0‿'c',2‿'d'⟩𝕏○(3⥊<)⟨01,"ch"⟩}¨ <‿>‿≠‿=‿≤‿≥ +0‿' '‿' ' ≡ ⊑»⥊ 0‿1‿'c'+○<0‿'b'‿2 +0‿' '‿0 ≡ ⊑»⥊ 0‿'b'‿'c'-○<0‿1‿'c' # Fill-preserving functions -' ' ≡ ⊑0⥊ ⥊@ +' ' ≡ ⊑» ⥊@ " ab" ≡ ⥊»2‿∘⥊"abcd" (≍3⥊<" ") ≡ »≍3⥊<"abcd" " cba" ≡ ¯4↑⌽"abc" "bca " ≡ 4↑1⌽"abc" ≡○»⟜(⊏≍) ⥊<"ab"‿∞ " bc" ≡ »«"abc" -" "‿0 ≡ ⊑0⥊»4⥊<"str"‿∞ +" "‿0 ≡ ⊑1↑0⥊»4⥊<"str"‿∞ "c " ≡ 3↑⍉'c' (≍" ") ≡ »⍉⌊‿1⥊"wxy" " "≡1↑»3/"ab" ⟨⟨⟩⟩ ≡ »0‿1/↑1↓↕2 -0‿0 ≡ ⊑0↑0‿0⍉↕3‿2 -' '‿0 ≡ ⊑0⥊1‿2‿0⍉3↕(<'a'‿1)+↕4‿5 +0‿0 ≡ ⊑1↑0↑0‿0⍉↕3‿2 +' '‿0 ≡ ⊑»1‿2‿0⍉3↕(<'a'‿1)+↕4‿5 "cb " ≡ 4↑2‿1⊏"abc" -(3⥊0) ≡ ⊑0⥊ ⟨2‿0,<1,≍1‿3⟩⊏↕3‿2‿4 +(3⥊0) ≡ ⊑» ⟨2‿0,<1,≍1‿3⟩⊏↕3‿2‿4 " cba" ≡ ¯4↑⍷"cbaba" "abc " ≡ 5↑∧"bca" "cabc " ≡ 5↑⊏∨3‿4⥊"abc" -0‿' ' ≡ ⊑0⥊ <` (↕3) + <0‿'x' +0‿' ' ≡ ⊑» <` (↕3) + <0‿'x' # Fill 0 ⌽⊸≡ 7↑/2‿3 ∧´{0≡⊑»𝕏"abdbcda"}¨ ≢‿⍋‿⍒‿∊‿⊐‿⊒ -0≡⊑≢8 -∧´⟨6‿2⥊↕2,5‿2⥊↕3⟩⊸{0≡⊑0⥊𝕏´𝕨}¨ ⍋‿⍒‿∊‿⍷‿⊐‿⊒ +0≡⊑1↑≢8 +∧´⟨6‿2⥊↕2,5‿2⥊↕3⟩⊸{0≡⊑1↑0⥊𝕏´𝕨}¨ ⍋‿⍒‿∊‿⍷‿⊐‿⊒ # Combinations (' '¨⊸≍"abc") ≡ »>⟨"abc","def"⟩ -" "≡⊑>2⥊<0⥊<"ab" -" "≡⊑>0⥊<<"ab" +" "≡⊑1↑⥊>2⥊<0⥊<"ab" +" "≡⊑1↑>0⥊<<"ab" (' '¨⊸≍"abc") ≡ »"abc"≍"def" -≡○(⊑0⊸⥊)⟜(∾↑) (↕3) + <⟨0,'a'‿2⟩ -0‿0 ≡ ⊑0⊸⥊ 1‿3∾○↕2‿3 +≡○(⊑»)⟜(∾↑) (↕3) + <⟨0,'a'‿2⟩ +0‿0 ≡ ⊑» 1‿3∾○↕2‿3 " ax" ≡ »"a"»"xyz" -0‿0 ≡ ⊑0⊸⥊ 5‿4<⊸«⥊↕2‿2 +0‿0 ≡ ⊑» 5‿4<⊸«⥊↕2‿2 # Group -"" ≡ ⊑0⥊⟨⟩⊔"" -0‿0 ≡ ⊑⊑⟨⟩⊔0⥊<↕2 +"" ≡ ⊑1↑⟨⟩⊔"" +0‿0 ≡ ⊑1↑⊑1↑⟨⟩⊔0⥊<↕2 0‿1‿1‿0 ≡ ⊐4↑2‿1⊔"aa" -" " ≡ (⊑0⥊⊢)¨ 2‿1⊔"aa" +" " ≡ (⊑1↑0⥊⊢)¨ 2‿1⊔"aa" diff --git a/test/cases/prim.bqn b/test/cases/prim.bqn index a75da9d0..1bf0a599 100644 --- a/test/cases/prim.bqn +++ b/test/cases/prim.bqn @@ -149,6 +149,8 @@ (⊑≡⊣´)"a"‿2‿(3‿"d") 0(⊑≡⊣´)"a"‿2‿(3‿"d") (2⊸⊑≡⊢´)"a"‿2‿(3‿"d") +! % ⊑"" +! % ⊑2‿0⥊⟨⟩ 2(⊣≡⊢´)"a"‿2‿(3‿"d") 7‿10≡+¨´⟨⟨2,3⟩,⟨5,7⟩⟩ ! % +´11 @@ -222,6 +224,7 @@ ! % ¯3⥊3 ! % 1.6‿2.5⥊↕4 ! % (≍2‿3)⥊↕3 +! % " "≡5⥊"" 6(⊢⌜≡∾○≢⥊⊢)○↕3 (<≡↕)⟨⟩ (↕∘⥊≡⥊¨∘↕)9 -- cgit v1.2.3