4c: Tank Printer

+wash

Render tank at width.

Render .tac with indent .tab and maximum width .edg. If .tac cannot be rendered in-line in less than .tac characters, it will be split into multiple lines if possible. If .tac cannot be made to fit, +wash will crash.

Accepts

[tab=@ edg=@] - .tab is the number of characters of indentation and $edge is the maximum number of characters of width.

.tac is a $tank.

Produces

A +wall (list of $tapes).

Source

++  wash
  |=  [[tab=@ edg=@] tac=tank]  ^-  wall
  (~(win re tac) tab edg)

Examples

> =rose `tank`[%rose [" " "[" "]"] ~['abc' 'def' 'ghi']]

> ((slog (crip (of-wall:format (wash [0 80] rose))) ~) ~)
[abc def ghi]


> ((slog (crip (of-wall:format (wash [0 8] rose))) ~) ~)
[ abc
  def
  ghi
]

> ((slog (crip (of-wall:format (wash [3 15] rose))) ~) ~)
   [ abc
     def
     ghi
   ]

+re

Pretty-printing engine.

Container core for a pretty-printing engine that accepts a $tank sample and contains arms that perform computation on it.

Accepts

.tac is a $tank.

Source


+ram:re

Flatten to tape.

Flatten $tank out into a $tape.

Accepts

.tac is a $tank, taken from sample of +re core.

Produces

A $tape.

Source

Examples


+win:re

Render at indent.

Render at indent level .tab and width .edg.

Accepts

.tac is a $tank, taken from sample of +re core.

.tab and .edg are $atoms.

Produces

A +wall (list of $tape).

Source

Examples


+show

Pretty-printer (deprecated).

Pretty prints $noun .vem, producing a $tank. This function is deprecated and in most cases produces outdated syntax or incorrect results.

Accepts

.vem is a $noun.

Produces

A $tank.

Source


Last updated