aboutsummaryrefslogtreecommitdiff
path: root/doc/combinator.bqn
blob: fa4466f70999ca83f1d154bfe34b940466ca0a31 (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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
Text  "text" Attr "dy""0.32em"∾⊢

wh  280260
Pnt  3257×⌽

comps  "∘○˙⊸⟜˜⊘"
names  (¬×+`)-=' ' "Atop Over Constant Before After Self/Swap Cases"

ps  At "class=yellow|style=fill:none|stroke-width=2"
_trans  {𝕗 At "transform=translate("(⊣∾","∾⊢)FmtNum∾")"˙}
Groups  ("g"At"font-size=20px|text-anchor=middle")_trans˜⌜

rc  At "class=code|stroke-width=1|rx=12"
rc  (Pos¯0.43×w,1)"width""height"˘FmtNum0.86×w,h-55
cc  At "r=12|class=code|stroke-width=0"
n  Text2"y",FmtNum h-37, "fill","currentColor"
case  (¯11×w÷4.6) ("g"At"font-size=21px|font-family=BQN,monospace")_trans¨ 25
lt Text2"y",FmtNum h-105, "font-size","19px"

FromPath  ≠⋈+´
Connect  {
  e  FromPath ¯1𝕨
  curve  11.3, 11.250.91, 0.51.2510
  c  𝕨 ((1=≠)(2=⊑))⟨⟩‿((((⊢×≢⊢⥊1⋈⊣)curve˜×)×)(1)) 𝕩
  "path" Elt ps"d",("M"(2÷˜c)"LQC")(Fmt Pnt˘(2))¨e(c𝕩)
}

DrawComp  {𝕊𝕩:(names˜comps𝕩)𝕊𝕩; names 𝕊 spel:
  sh   spel
  ops  •BQN¨ spel
  m2   ¬spel"˙˜"
  isC  spel='˙'
  _symb  {𝕗<∾⋈}
  lrand  isC"𝔽"_symb,"𝕗"
  lrsp   isC"𝔽""𝕗"

  app  m2 {o𝕩ops𝕨{𝕩_o}{𝕩_o_("𝔾"_symb)}𝕩lrand}¨ sh
  res  >{𝕏"𝕩","𝕨"𝕏"𝕩"}¨app
  map  ⟨⟩{(1<≡)((𝕨0)⋈⊢)((𝕨⋈⊑)·𝕊¨˜(𝕨¨((2×↕)- -1))1↓⊢)𝕩}¨res
  pathname  <˘><˘¨map

  notBase  (1<≠)1,0¯1¨¨ path
  path ¨¨˜ notBase
  vv  (1↓⌽↓"𝕨""𝕩")      ˜¨1 notBase /¨ name
  vl  (2 0 0⟩‿⟨¯1,1) ˜¨1 notBase FromPath¨/¨ path
  vp  Pnt¨¨ vl

  g  (20+h×⊢)Groups(5+w×0.5+⊢)´ sh
  label   """𝕨 "  " 𝕩"¨ lrsp¨spel(/"𝔾")¨m2

  (0,2.4×w(⊣∾-˜÷2˙)10+hw×sh) SVG g Enc¨ <1⍉>sh¨
    sh⥊< "rect" Elt rc
    nEnc¨ names
    (< case Enc¨ )1 ¨´ 
      (<lt Enc Highlight)¨ label
      path Connect¨¨(vl¨˜vv(⊐⌈≠⊣|⊒)¨)((0<≠¨¨path)/¨) name
      ("circle" Elt cc"cx","cy"˘FmtNum)¨¨ vp
      vp TextPosEncHighlight¨¨ vv
    
  
}

DrawComp 23comps