diff options
| author | Marshall Lochbaum <mwlochbaum@gmail.com> | 2020-10-16 14:21:28 -0400 |
|---|---|---|
| committer | Marshall Lochbaum <mwlochbaum@gmail.com> | 2020-10-16 14:32:38 -0400 |
| commit | eb8e63d3a97f99b8a3da0573fc585953ef441314 (patch) | |
| tree | 24537557656a943a0530b7cf692574d19b47d1f3 /tutorial/evalexp.bqn | |
| parent | b200828af7474d93bedae6246e15d6037be7fc42 (diff) | |
Another evaluation diagram
Diffstat (limited to 'tutorial/evalexp.bqn')
| -rw-r--r-- | tutorial/evalexp.bqn | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/tutorial/evalexp.bqn b/tutorial/evalexp.bqn index 5d922af1..17c8c0db 100644 --- a/tutorial/evalexp.bqn +++ b/tutorial/evalexp.bqn @@ -1,6 +1,7 @@ wh ← 10.75‿24 pad← wh×2‿1 -t ← 10 +to ← 1+wh÷2‿3 +t ← 10 ps ← At "class=Paren|stroke=currentColor|fill=none|stroke-width=1" rc ← At "class=code|stroke-width=1|rx=10" @@ -15,20 +16,20 @@ Shadow ← { DrawEval←{ ix←𝕩⊏˜i←/𝕩≠' ' - f←0=b←-˝p←"()"=⌜ix - l←<⟜«fn←ix∊"+-×÷⋆√" + f←0=b←(op←'('=ix)-')'=ix + l←op<<⟜«fn←ix∊"+-×÷⋆√" g←⍋+`b ei←¯1∾˜b{((𝕨<0)/𝕩)⌾((𝕨>0)⊸/)𝕩}○(g⊸⊏)»+`f o←ei⊏˜f/↕∘≠⊸-⌾(g⊸⊏)(1+»l)(⊢+fn×-)1-2×l g⊏˜↩⍋g⊏l - rev←⍋+`¯1↓(¯1∾g)(⊣⍋⊸⊏⊏˜⟜⍋¬⊏˜)⍋+`⊸+1∾g⊏l∨⊏p + rev←⍋+`¯1↓(¯1∾g)(⊣⍋⊸⊏⊏˜⟜⍋¬⊏˜)⍋+`⊸+1∾g⊏l∨op m←1+⌈´d←+`⊸×⌾(rev⊸⊏)fn pt ← f/⍉> wh×⟨i,d⟩ off← (o ⊏ ∾⟜(whׯ1.25‿m))⊸- pt pd ← pt (<(wh×0.6‿0.1)⊸+)⊸∾⟜⌽˘ off dim← (wh×⟨≠𝕩,2+m⟩)+2‿0×pad - tp ← <˘pt+(1+wh÷2‿3)+⎉1(0‿1×⌜˜f/¬fn)×off + tp ← <˘pt+to+⎉1(0‿1×⌜˜f/¬fn)×off (512‿0⊸⌈⊸(⊣∾˜(t+pad)-˜-˜÷2˙)dim+2×t) SVG gr Enc ∾⥊¨⟨ <"rect" Elt rc∾(Pos-pad)∾"width"‿"height"≍˘FmtNum¨dim <"text" Enc Highlight 𝕩 |
