diff options
| author | Marshall Lochbaum <mwlochbaum@gmail.com> | 2020-07-09 18:53:03 -0400 |
|---|---|---|
| committer | Marshall Lochbaum <mwlochbaum@gmail.com> | 2020-07-09 19:01:14 -0400 |
| commit | 729359e26e8d0ce9a43e53a7a87d0c982270035e (patch) | |
| tree | 4d5fe062b2ae881341657e8213bf5b3ff57e97d6 | |
| parent | d69cb9ec07fe52297bb33140a6780f5620285951 (diff) | |
Support direct application of operators
| -rwxr-xr-x | dc.bqn | 15 | ||||
| -rw-r--r-- | test/bcases.bqn | 4 |
2 files changed, 12 insertions, 7 deletions
@@ -129,15 +129,16 @@ Compile←{ DParse ← {nv‿r𝕊𝕩: l←≠𝕩⋄sep←𝕩∊bS⋄rev←⌽⍋⍋⌽+`(≠↑0∾⊢)⊸∨sep⋄𝕩⊏˜↩rev⋄r⊏˜↩rev o←𝕩=1⊑bB⋄g←⍋d←+`o-𝕩=0⊑bB⋄ps←g⊏o∨sep - xf←⌽(¬o∨sep)=○(⌈`(1+↕∘≠)⊸×)○⌽1=r - 𝕩⊏˜↩g⋄r⊏˜↩g⋄v←𝕩≥vi⋄a←𝕩∊2↑bG⋄s←/𝕩∊bS⋄f←(l↑0∾1+g)⊏xf∾0 + xf←⌽(¬o∨sep)=○(⌈`(1+↕∘≠)⊸×)○⌽(¯1⌽2≤r)∨1≤r + 𝕩⊏˜↩g⋄r⊏˜↩g⋄v←𝕩≥vi⋄a←𝕩∊2↑bG⋄s←/𝕩∊bS⋄op←r≥2⋄f←(l↑0∾1+g)⊏xf∾0 tr←ps+`⊸⊏(0∾ps/g)⊏xf - tf←tr∧2(|<≤)ps(⊢-⌈`∘×)↕l - fa←/(tr<f)∨tf∧a<○(⌈`(1+↕∘≠)⊸×)ps + tf←tr∧2(|<≤)ps(⊢-⌈`∘×)+`¬op + ro←1⌽r=3⋄os←⌽↕∘≠⊸(⊣-⌈`∘×)⌽¬ro∨¯1⊸⌽⊸∨op + oa←⌽/op⋄fa←/ro<((tr∨op)<f∨¯1⌽op)∨tf∧a<○(⌈`(1+↕∘≠)⊸×)ps dy←fa⊏1↓0∾˜(tr>tf∨ps)∨v∨f<𝕩=0⊑bB - n←𝕩≥vi+nv⋄id←/v-n⋄cn←/n∨𝕩∊bF⋄u←⍷ob←cn⊏𝕩 - or←⍋g⊏˜∾⟨cn,cn,id,id,1+/a,s,fa+dy⟩ - bc←or⊏∾⟨0¨cn,u⊐ob,1+(id-1)⊏a,vi-˜id⊏𝕩,(11-⊑bG)+a/𝕩,14¨s,5+dy+4×fa⊏tr⟩ + n←𝕩≥vi+nv⋄id←/v-n⋄cn←/n∨𝕩≤¯1⊑bC⋄u←⍷ob←cn⊏𝕩 + or←⍋g⊏˜∾⟨cn,cn,id,id,1+/a,s,oa+1⌈1-˜oa⊏os,fa+dy⟩ + bc←or⊏∾⟨0¨cn,u⊐ob,1+(id-1)⊏a,vi-˜id⊏𝕩,(11-⊑bG)+a/𝕩,14¨s,5+oa⊏r,5+dy+4×fa⊏tr⟩ bc‿u } diff --git a/test/bcases.bqn b/test/bcases.bqn index 2b0ea3eb..23fa1257 100644 --- a/test/bcases.bqn +++ b/test/bcases.bqn @@ -6,3 +6,7 @@ 3 % DiffSq←+×((-))⋄√5 DiffSq 4 3 % a←3,2 A 4 -2 % F←G←-⋄G↩+⋄h←0⊑f∾g⋄H 2 +9 % ט-3 +1 % 3-˜4 +0.25 % 4-˜○÷2 +3 % √5-○(ט)4 |
