aboutsummaryrefslogtreecommitdiff
path: root/tutorial/evalexp.bqn
blob: 304301e583dc7ca7a6ffcae17caf92ef95685357 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
wh  10.7524
pad wh×1.51
t  10

ps  >"stroke""#585552","style""fill:none","stroke-width""2"
rc  >"class""code","stroke-width""1","rx""12"
gr  "g" Attr >"font-family""BQN,monospace", "font-size""18px"

DrawEval{
  ix𝕩˜i/𝕩' '
  f0=b-˝p"()"=ix
  l<«fnix"+-×÷⋆√"
  g⍋+`b
  ei¯1˜b{((𝕨<0)/𝕩)((𝕨>0)/)𝕩}(g)»+`f
  oei˜f/↕-(g)(1l)(⊢+fn×-)1-2×l
  g˜gl
  rev⍋+`¯1(¯1g)(⊣⍋⊏⊏˜⍋¬⊏˜)⍋+`+1gl∨⊏p
  m1+⌈´d+`×(rev)fn

  pt  f/⍉> wh×i,d
  off (o  (whׯ1m))- pt
  pd  pt (<(wh×0.60.1)+)˘ off
  dim (wh×𝕩,2+m)+20×pad
  (5120(⊣∾˜(t+pad)-˜-˜÷2˙)dim+2×t) SVG gr Enc ∾⥊¨
    <"rect" Elt rc(Pos-pad)"width""height"˘FmtNum¨dim
    <"text" Enc Highlight 𝕩
    (<"path" Elt ps"d"<·"Mvh"Fmt¨)˘ pd
  
}