Constants (Atoms and Strings)

The simplest expressions in every language are constants: atoms, strings, paths. (Strings and paths aren't all constants per se, because they have interpolations.)

Cold Atom

A constant, cold atom.

Syntax

Any warm atom form, prefixed with %.

AST

[%rock p=term q=*]

Discussion

A cold atom is one whose type is inferred to be of a single atom constant.

Examples

We can see the contrast with warm atoms by using the compiler parser function, +ream:

> (ream '%hi')
[%rock p=%tas q=26.984]

> (ream '\'hi\'')
[%sand p=%t q=26.984]

> (ream '%12')
[%rock p=%ud q=12]

Paths

Path with interpolation.

Syntax

/this/is/a/path

Produces

A null-terminated list of the items, which are either constant @ta atoms ($knots), or expressions producing a $knot.

Examples


Strings with Interpolation

Text string with interpolation.

Syntax

A $tape

"abcdefg"

"abc{(weld "lmnop" "xyz")}defg"

AST

Produces

A tape.

Examples

String:

String with interpolation:

String with interpolated prettyprinting:


Warm Atoms

A constant, warm atom.

Syntax

A table of examples:

AST

Discussion

A 'warm' atom is one whose type is inferred to be general, i.e., not just a single atom type.

Produces

A warm (variable) atom .q with aura .p. Use the Hoon compiler parser function +ream to take a closer look:

Last updated