diff options
Diffstat (limited to 'test/cases')
| -rw-r--r-- | test/cases/fill.bqn | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/test/cases/fill.bqn b/test/cases/fill.bqn new file mode 100644 index 00000000..ef9e86c3 --- /dev/null +++ b/test/cases/fill.bqn @@ -0,0 +1,69 @@ +# String fill +' ' ≡ ⊑"" + +# Match doesn't use fills +"ab" ≡○(0⊸↑) ↕2 + +# Functions that fill +" "≡5⥊"" +("abc"≍"de ") ≡ 2‿↑⥊"abcde" +"abc "≡5↑"abc" +" ab" ≡ »"abc" +"bc " ≡ «"abc" + +# Box generates arbitrary fill elements +∧´ (2⊸↑ ≡ 1‿0⊸×)∘<¨ ⟨π, ↕3, "", 2+⌜○↕3, ≍˘⟨2‿1,↕4‿2⟩⟩ +(0¨ ≡ 1⊑2↑<) ∞‿¯∞‿0 +" "‿0 ≡ ⊑0⥊<"xy"‿¯π +⟨7⥊0‿' '⟩ ≡ »≍<'a'⍟(2⊸|)¨↕7 + +# Special cases +0 ≡ ⊑↕0 +0‿1‿2‿0 ≡ 4↑↕3 +≡⟜(⊑↕) 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' + +# Fill-preserving functions +' ' ≡ ⊑0⥊ ⥊@ +" ab" ≡ ⥊»2‿∘⥊"abcd" +(≍3⥊<" ") ≡ »≍3⥊<"abcd" +" cba" ≡ ¯4↑⌽"abc" +"bca " ≡ 4↑1⌽"abc" +≡○»⟜(⊏≍) ⥊<"ab"‿∞ +"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 +"cb " ≡ 4↑2‿1⊏"abc" +(3⥊0) ≡ ⊑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' + +# Fill 0 +⌽⊸≡ 7↑/2‿3 +∧´{0≡⊑»𝕏"abdbcda"}¨ ≢‿⍋‿⍒‿∊‿⊐‿⊒ +∧´⟨6‿2⥊↕2,5‿2⥊↕3⟩⊸{0≡⊑0⥊𝕏´𝕨}¨ ⍋‿⍒‿∊‿⍷‿⊐‿⊒ + +# Combinations +(' '¨⊸≍"abc") ≡ »>⟨"abc","def"⟩ +(' '¨⊸≍"abc") ≡ »"abc"≍"def" +≡○(⊑0⊸⥊)⟜(∾↑) 0‿'a'‿2 + <⟨0,1‿2⟩ +0‿0 ≡ ⊑0⊸⥊ 1‿3∾○↕2‿3 + +# Group +"" ≡ ⊑0⥊⟨⟩⊔"" +0‿1‿1‿0 ≡ ⊐4↑2‿1⊔"aa" +" " ≡ (⊑0⥊⊢)¨ 2‿1⊔"aa" |
