2title = "4c: Tank Printer"
11Pretty-printing engine that accepts a `++tank` sample and contains arms that perform computation on it.
28 <2.gdc {tac/{$leaf ""} <402.arm 110.jyx 1.ztu $151>}>
37Flatten `++tank` out into a `++tape`.
41`tac` is a `++tank`, taken from sample of `++re` core.
54 $palm ram(tac [%rose [p.p.tac (weld q.p.tac r.p.tac) s.p.tac] q.tac])
61 =+ voz=$(q.tac t.q.tac)
62 (weld ram(tac i.q.tac) ?~(t.q.tac voz (weld p.p.tac voz)))
70 > ~(ram re leaf+"foo")
72 > ~(ram re rose+["." "(" ")"]^~[leaf+"bar" leaf+"baz" leaf+"bam"])
82Render at indent level `tab` and width `edg`.
86`tac` is a `++tank`, taken from sample of `++re` core.
88`tab` and `edg` are atoms.
92A `++wall` (`++list` of `++tapes`).
109 (rig(tab (add 2 tab), lug $(tac i.q.tac)) q.p.tac)
110 => .(q.tac `(list tank)`q.tac)
111 =+ lyn=(mul 2 (lent q.tac))
118 tab (add tab (sub lyn 2))
119 lug $(q.tac t.q.tac, lyn (sub lyn 2))
121 (wig(lug qyr) q.p.tac)
128 > (~(win re leaf+"samoltekon-lapdok") 0 20)
129 <<"samoltekon-lapdok">>
131 > (~(win re leaf+"samoltekon-lapdok") 0 10)
132 <<"\/samolt\/" " ekon-l" " apdok" "\/ \/">>
134 > (~(win re rose+["--" "[" "]"]^~[leaf+"1423" leaf+"2316"]) 0 20)
137 > (~(win re rose+["--" "[" "]"]^~[leaf+"1423" leaf+"2316"]) 0 10)
138 <<"[ 1423" " 2316" "]">>
153 ++ din (mod (add 2 tab) (mul 2 (div edg 3)))
161Determine whether `tac` fits on one line. Internal to `++win`
169++ fit (lte (lent ram) (sub edg tab))
179Wrap `++tape` in `\/` if it doesn't fit at current indentation. Internal to
184`tac` is a `++tank`, taken from sample of `++re` core.
190A `++wall` (list of `++tape`s).
198 ?: & ::(lte (lent hom) (sub edg tab))
199 [(runt [tab ' '] hom) lug]
200 => .(tab (add tab 2), edg (sub edg 2))
201 =+ mut=(trim (sub edg tab) hom)
202 :- (runt [(sub tab 2) ' '] ['\\' '/' (weld p.mut `_hom`['\\' '/' ~])])
208 ['\\' '/' (runt [(sub edg tab) ' '] ['\\' '/' ~])]
210 => .(mut (trim (sub edg tab) hom))
211 [(runt [tab ' '] p.mut) $(hom q.mut)]
223Render `++tape`. Internal to `++win`.
227`tac` is a `++tank`, taken from sample of `++re` core.
240 =+ wug=:(add 1 tab lin)
244 ?|(=(0 wug) ?&(=(' ' i.mir) $(mir t.mir, wug (dec wug))))
245 (rig hom) :: ^ XX regular form?
246 [(runt [tab ' '] (weld hom `tape`[' ' (slag wug i.lug)])) t.lug]
256 ++ show :: XX deprecated, use span
260 [%leaf (mesc (trip vem))]
263 [%leaf '\'' (weld (mesc (tape +.vem)) `tape`['\'' ~])]
265 {s/$a c/@} [%leaf (mesc (trip c.vem))]
266 {s/$b c/*} (shop c.vem |=(a/@ ~(rub at a)))
269 [['.' ~] ['-' ~] ~ ~]
270 [[%leaf (mesc (trip p.s.vem))] $(vem c.vem) ~]
272 {s/$d c/*} (shop c.vem |=(a/@ ~(rud at a)))
273 {s/$k c/*} (tank c.vem)
277 =+ yol=((list @ta) c.vem)
278 (turn yol |=(a/@ta [%leaf (trip a)]))
280 {s/$l c/*} (shol c.vem)
284 :- [%m '%h:<[%d %d].[%d %d]>']
285 [-.c.vem +<-.c.vem +<+.c.vem +>-.c.vem +>+.c.vem ~]
288 {s/$p c/*} (shop c.vem |=(a/@ ~(rup at a)))
289 {s/$q c/*} (shop c.vem |=(a/@ ~(r at a)))
290 {s/$r c/*} $(vem [[%r ' ' '{' '}'] c.vem])
291 {s/$t c/*} (shop c.vem |=(a/@ ~(rt at a)))
292 {s/$v c/*} (shop c.vem |=(a/@ ~(ruv at a)))
293 {s/$x c/*} (shop c.vem |=(a/@ ~(rux at a)))
294 {s/{$m p/@} c/*} (shep p.s.vem c.vem)
296 $(vem [[%r ' ' (cut 3 [0 1] p.s.vem) (cut 3 [1 1] p.s.vem)] c.vem])
298 {s/{$r p/@ q/@ r/@} c/*}
300 :* p=(mesc (trip p.s.vem))
301 q=(mesc (trip q.s.vem))
302 r=(mesc (trip r.s.vem))
307 [^$(vem -.c.vem) $(c.vem +.c.vem)]
309 {s/$z c/*} $(vem [[%r %$ %$ %$] c.vem])
328 =+ c=(cut 3 [i 1] fom)
330 (weld (mesc [c ~]) $(i +(i)))
331 =+ d=(cut 3 [+(i) 1] fom)
333 ['\\' '#' $(i (add 2 i))]
334 (weld ~(ram re (show d -.gar)) $(i (add 2 i), gar +.gar))
344 |= {aug/* vel/$-(a/@ tape)}
349 [[' ' ~] ['[' ~] [']' ~]]
354 [^$(aug -.aug) $(aug +.aug)]
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list