Formatting text: a guide to std/fmt and its blocks
A section in "Writing programs" on (std fmt): what a block and a vec of blocks are, what goes in the brackets and how to convert the rest, blocks from data, padding, numbers, paragraphs, tables, settings, and what to write when it does not compile. The std/fmt entry in Part III gives the rule and points to it, and no longer names str*. 🤖 Generated with [ECA](https://eca.dev) (anthropic/claude-opus-5-5) Co-Authored-By: eca-agent <git@eca.dev>
This commit is contained in:
parent
21d0c9de06
commit
aaf92b38c1
2 changed files with 394 additions and 3 deletions
|
|
@ -19,9 +19,7 @@ For more details, see @link["modules/std/array.html"]{@code{(std array)}} and @l
|
|||
|
||||
@subsection{std/fmt}
|
||||
|
||||
Formatting in Bjolang is divided into two layers: interpolation and layout.
|
||||
Interpolation provides a simple way to combine mixed scalar types into strings or print them directly using @code{println*} and @code{str*}.
|
||||
The layout layer provides a composable block algebra for more complex text formatting, such as padding, aligning, wrapping paragraphs, and laying out tables.
|
||||
Formatting in two layers: interpolation and layout. @code{println*} prints strings, ints, doubles, chars and bools written in one vec. The layout layer is made of blocks: a @code{Block} is one piece of output, and every combinator takes its content as a @code{(Vec Block)}, a vec literal such as @code{["x = " 7 nl]}, and gives back one @code{Block}. With them you pad, cut and align text, wrap and justify paragraphs, format numbers, and lay out tables with borders, a header, and columns that fit the width. The section on formatting text in "Writing programs" is a guide, with what goes in the brackets and what to write when it does not compile.
|
||||
For more details, see @link["modules/std/fmt.html"]{@code{(std fmt)}}.
|
||||
|
||||
@subsection{std/rx}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue