4k: Atom Printing

+co

Literal rendering engine.

+co contains three parts:

  • A door that contains arms that operate on the sample $coin .lot.

  • A core of rendering idioms.

  • A core of additional formatting functions used internally.

Accepts

.lot is a $coin.

Source

The arm begins with the door:

++  co
  !:
  ~%  %co  ..co  ~
  =<  |_  lot=coin

Then after that the rendering idiom core begins with:

=|  rep=tape
=<  |%

And finally the third core:


+rear:co

Prepend & render as $tape.

Renders a $coin .lot as a $tape prepended to the sample $tape .rom.

Accepts

.lot is a $coin, and is the sample of +co.

.rom is a $tape.

Produces

A $tape.

Source

Examples


+rent:co

Render as $knot.

Renders a $coin .lot as a $knot.

Accepts

.lot is a $coin, and is the sample of +co.

Produces

A $knot.

Source

Examples


+rend:co

Render as $tape.

Renders a $coin .lot as a $tape.

Accepts

.lot is a $coin, and is the sample of +co.

Produces

A $tape.

Source

Examples


+a-co:co

Render decimal.

Render .dat as a decimal integer without separators.

Accepts

.dat is an $atom.

Produces

A $tape

Source

Examples


+c-co:co

Render base58check.

Renders the given $atom as a base58check $tape.

Accepts

An $atom.

Produces

A $tape.

Source

Examples


+d-co:co

Render decimal with min length.

Render .hol as a decimal integer without separators and with a minimum length of .min. If .hol has less than .min digits, leading zeros will be added to make up the difference.

Accepts

.min is an $atom.

.hol is an $atom.

Produces

A $tape.

Source

Examples


+r-co:co

Render floating point.

Render decimal float .a as a $tape.

Accepts

.a is a +dn.

Produces

A $tape.

Source

Examples


+s-co:co

Render hex list.

Render .esc, a list of $atoms, as hex with a dot before each value. Values less than two bytes in length will be padded with zeros.

Accepts

.esc is a (list @).

Produces

A $tape.

Source

Examples


+v-co:co

Render base-32 with minimum length.

Render .hol as base-32 with a minimum length of .min. If .hol is shorter than .min it will be padded with zeros.

Accepts

.min is a @ud.

.hol is an $atom.

Produces

A $tape.

Source

Examples


+w-co:co

Render base-64 with minimum length.

Render .hol as base-64 with a minimum length of .min. If .hol is horter than .min it will be padded with zeros.

Accepts

.min is a @ud.

.hol is an $atom.

Produces

A $tape.

Source

Examples


+x-co:co

Render hex with minimum length.

Render .hol as hex with a minimum length of .min. If .hol is horter than .min it will be padded with zeros.

Accepts

.min is a @ud.

.hol is an $atom.

Produces

A $tape.

Source

Examples


+y-co:co

Render decimal with at least two digits.

Render .dat as a decimal with a minimum of two digits. If .dat is less than two digits it will be padded with zeros.

Accepts

.dat is an $atom.

Produces

A $tape.

Source

Examples


+z-co:co

Render 0x-prefixed hex.

Render .dat as hex with a 0x prefix.

Accepts

.dat is an $atom.

Produces

A $tape.

Source

Examples


+em-co:co

Render in numeric base.

In base .bas, format .min digits of .hol with .par. This is used internally by other rendering functions.

  • .hol is processed least-significant digit first.

  • All available digits in .hol will be processed, but .min digits can exceed the number available in .hol

  • .par handles all accumulated output on each call, and can edit it, prepend or append digits, etc.

  • Until .hol is exhausted, .par's sample is [| digit output], subsequently, it's [& 0 output].

Accepts

[bas=@ min=@], where .bas is the numeric base and .min is the minimum length.

.par is a $gate of $-([? @ tape] tape).

.hol is an $atom.

Produces

A $tape.

Source

Examples


+ed-co:co

Format with decimal place.

Format .int by specifying its size with .exp, which may be negative. This is used internally by other rendering functions.

Accepts

.exp is a @s.

.int is a $tape.

Produces

A $tape.

Source

Examples


+ox-co:co

Format dot-separated digits in numeric base.

In base .bas, format each digit of .hol with gate .dug, with '.' separators every .gop digits. This is used internally by other rendering functions.

  • .hol is processed least-significant digit first.

  • .dug handles individual digits, output is prepended.

  • Every segment but the last is zero-padded to .gop.

Accepts

[bas=@ gop=@] where .bas is the numeric base and .gop is dot separator frequency.

.dug is a $gate of $-(@ @).

.hol is an $atom.

Produces

A $tape.

Source

Examples


+ro-co:co

Format dot-prefixed bloqs in numeric base.

In base .bas, for .buz bloqs 0 to .dop, format at least one digit of .hol, prefixed with .. This is used internally for @i address rendering functions.

Accepts

[buz=@ bas=@ dop=@] where .buz is the bloq size, .bas is the numeric base, and .dop is the number of bloqs.

.dug is a $gate of $-(@ @).

.hol is an $atom.

Produces

A $tape.

Source

Examples


Last updated