2title = "4c: Tank Printer"
11Render `tac` with indent `tab` and maximum width `edg`. If `tac` cannot be
12rendered in-line in less than `tac` characters, it will be split into multiple
13lines if possible. If `tac` cannot be made to fit, `wash` will crash.
17`[tab=@ edg=@]` - `tab` is the number of characters of indentation and `edge` is
18the maximum number of characters of width.
24A `wall` (list of `tape`s).
30 |= [[tab=@ edg=@] tac=tank] ^- wall
31 (~(win re tac) tab edg)
37> =rose `tank`[%rose [" " "[" "]"] ~['abc' 'def' 'ghi']]
39> ((slog (crip (of-wall:format (wash [0 80] rose))) ~) ~)
43> ((slog (crip (of-wall:format (wash [0 8] rose))) ~) ~)
49> ((slog (crip (of-wall:format (wash [3 15] rose))) ~) ~)
60Container core for a pretty-printing engine that accepts a `tank` sample and contains arms that perform computation on it.
79Flatten `tank` out into a `tape`.
83`tac` is a `tank`, taken from sample of `++re` core.
99 :: flat %palm rendered as %rose with welded openers
103 =* for (weld q.p.tac r.p.tac)
105 ram(tac [%rose [mid for end] q.tac])
107 :: flat %rose rendered with open/mid/close
122 ?~(t.lit voz (weld mid voz))
129> ~(ram re leaf+"foo")
132> ~(ram re [%rose [" " "[" "]"] ~['abc' 'def' 'ghi']])
142Render at indent level `tab` and width `edg`.
146`tac` is a `tank`, taken from sample of `++re` core.
148`tab` and `edg` are atoms.
152A `wall` (list of `tape`).
170 ?: (lte (lent hom) (sub edg tab))
183 => .(lit `(list tank)`lit)
184 =/ lyn (mul 2 (lent lit))
193 lug $(lit t.lit, lyn nyl)
199 ?: (lte (lent hom) (sub edg tab))
208 ?~(end lug (rig end))
211 tab (mod (add 2 tab) (mul 2 (div edg 3)))
214 ?~(for lug (wig for))
216 :: +rig: indent tape and cons with output stack
221 [(runt [tab ' '] hom) lug]
222 :: +wig: indent tape and cons with output stack
224 :: joined with the top line if whitespace/indentation allow
231 =/ wug :(add 1 tab (lent hom))
236 ?&(=(' ' i.mir) $(mir t.mir, wug (dec wug)))
238 (rig hom) :: ^ XX regular form?
241 (weld hom `tape`[' ' (slag wug i.lug)])
248> =rose `tank`[%rose [" " "[" "]"] ~['abc' 'def' 'ghi']]
250> ((slog (crip (of-wall:format (~(win re rose) 0 80))) ~) ~)
253> ((slog (crip (of-wall:format (~(win re rose) 3 80))) ~) ~)
256> ((slog (crip (of-wall:format (~(win re rose) 0 10))) ~) ~)
262> ((slog (crip (of-wall:format (~(win re rose) 3 15))) ~) ~)
273Pretty-printer (deprecated)
275Pretty prints noun `vem`, producing a `tank`. This function is deprecated and in
276most cases produces outdated syntax or incorrect results.
293 [%leaf (mesc (trip vem))]
296 [%leaf '\'' (weld (mesc (tape +.vem)) `tape`['\'' ~])]
298 [s=%a c=@] [%leaf (mesc (trip c.vem))]
299 [s=%b c=*] (shop c.vem |=(a=@ ~(rub at a)))
302 [['.' ~] ['-' ~] ~ ~]
303 [[%leaf (mesc (trip p.s.vem))] $(vem c.vem) ~]
305 [s=%d c=*] (shop c.vem |=(a=@ ~(rud at a)))
306 [s=%k c=*] (tank c.vem)
310 =+ yol=((list @ta) c.vem)
311 (turn yol |=(a=@ta [%leaf (trip a)]))
313 [s=%l c=*] (shol c.vem)
317 :- [%m '%h::[%d %d].[%d %d]>']
318 [-.c.vem +<-.c.vem +<+.c.vem +>-.c.vem +>+.c.vem ~]
321 [s=%p c=*] (shop c.vem |=(a=@ ~(rup at a)))
322 [s=%q c=*] (shop c.vem |=(a=@ ~(r at a)))
323 [s=%r c=*] $(vem [[%r ' ' '{' '}'] c.vem])
324 [s=%t c=*] (shop c.vem |=(a=@ ~(rt at a)))
325 [s=%v c=*] (shop c.vem |=(a=@ ~(ruv at a)))
326 [s=%x c=*] (shop c.vem |=(a=@ ~(rux at a)))
327 [s=[%m p=@] c=*] (shep p.s.vem c.vem)
329 $(vem [[%r ' ' (cut 3 [0 1] p.s.vem) (cut 3 [1 1] p.s.vem)] c.vem])
331 [s=[%r p=@ q=@ r=@] c=*]
333 :* p=(mesc (trip p.s.vem))
334 q=(mesc (trip q.s.vem))
335 r=(mesc (trip r.s.vem))
340 [^$(vem -.c.vem) $(c.vem +.c.vem)]
342 [s=%z c=*] $(vem [[%r %$ %$ %$] c.vem])
354 =+ c=(cut 3 [i 1] fom)
356 (weld (mesc [c ~]) $(i +(i)))
357 =+ d=(cut 3 [+(i) 1] fom)
359 ['\\' '#' $(i (add 2 i))]
360 (weld ~(ram re (show d -.gar)) $(i (add 2 i), gar +.gar))
363 |= [aug=* vel=$-(a=@ tape)]
368 [[' ' ~] ['[' ~] [']' ~]]
373 [^$(aug -.aug) $(aug +.aug)]
387 [%leaf '+' ~(rud at c.lim)]
391 [%leaf (weld (reap n.lim '^') ?~(c.lim "$" (trip c.lim)))]
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