v2026.11.2
All Bundles
Bundle

What a student needs to turn a study into a hand-in: Replicates collects the value of each metric per seed and per setting and reports the count, mean, sample standard deviation, range and a t confidence interval, with a paired comparison of two settings; ResultTables converts between a System.ML.Lab ResultTable and the other results (replicates, an OLS fit, t-tests, a grid of strings); Report builds one document with numbered sections, tables, figures, code and notes, written as Markdown or as one self-contained HTML file with a print stylesheet that prints cleanly to PDF from a browser.

No call here ends the program on bad input: a call that cannot do what it was asked returns false (or Nil) and the object keeps the reason, read with GetError(), which is "" when there is nothing to report. Output is deterministic: the same calls give the same bytes, and nothing reads a clock. Compile with -lib ml_report,ml_lab,ml,stats,plot,csv,json,gen_collect.

ReportText

Text helpers shared by the writers: escaping for HTML and Markdown, number formatting, Base64.

Operations

Base64 # function

Base64 of bytes, RFC 4648 with padding.

function : Base64(data:Byte[]) ~ String

Parameters

NameTypeDescription
dataBytethe bytes

Return

TypeDescription
Stringthe encoding, "" for Nil

HasHandler # function

True when lower-case markup holds an attribute such as onload= or onclick=.

function : HasHandler(lower:String) ~ Bool

Parameters

NameTypeDescription
lowerStringthe text in lower case

Return

TypeDescription
Booltrue when an event handler attribute is present

Html # function

Escapes text for HTML element content or a double-quoted attribute: & < > " and '.

function : Html(text:String) ~ String

Parameters

NameTypeDescription
textStringthe text, Nil is ""

Return

TypeDescription
Stringthe escaped text

IsNumber # function

Parses a plain decimal number; unlike String->ToFloat() it can tell that the text is not one.

function : IsNumber(text:String) ~ Bool

Parameters

NameTypeDescription
textStringthe text

Return

TypeDescription
Booltrue when the whole text is a number

Lines # function

Splits text into lines; CRLF, CR and LF all end a line. "" is one empty line and Nil is none.

function : Lines(text:String) ~ String[]

Parameters

NameTypeDescription
textStringthe text

Return

TypeDescription
Stringthe lines

LinkPath # function

Percent-encodes the characters of a file path that end a Markdown link target: space, parentheses, angle brackets and percent. Backslashes become slashes.

function : LinkPath(path:String) ~ String

Parameters

NameTypeDescription
pathStringthe path

Return

TypeDescription
Stringthe encoded path

LooksNumeric # function

True when the text looks like a number, a number with a deviation or n/a, so a table column of them is right-aligned.

function : LooksNumeric(text:String) ~ Bool

Parameters

NameTypeDescription
textStringa cell

Return

TypeDescription
Booltrue for numeric-looking text

MarkdownCell # function

Escapes a table cell or a heading for Markdown: every line escaped as MarkdownLine, joined with an HTML line break because a table row has one line.

function : MarkdownCell(text:String) ~ String

Parameters

NameTypeDescription
textStringthe text, Nil is ""

Return

TypeDescription
Stringthe escaped text

MarkdownLine # function

Escapes one line of text for Markdown so that nothing in it is read as markup: backslash, backtick, asterisk, underscore, brackets, braces, angle brackets, ampersand, pipe, tilde, dollar and caret anywhere, and # - + = or a number and a dot at the start of a line.

function : MarkdownLine(line:String) ~ String

Parameters

NameTypeDescription
lineStringone line, without a newline

Return

TypeDescription
Stringthe escaped line, without leading or trailing spaces

NormalizeNumbers # function

Replaces the spellings of NaN that a number formatter writes with "n/a".

function : NormalizeNumbers(text:String) ~ String

Parameters

NameTypeDescription
textStringa formatted cell

Return

TypeDescription
Stringthe cell with NaN spelled n/a

NotFinite # function

True for NaN, +Inf and -Inf.

function : NotFinite(v:Float) ~ Bool

Parameters

NameTypeDescription
vFloatthe number

Return

TypeDescription
Booltrue when the number is not finite

Number # function

A number with a fixed count of decimals; NaN is "n/a", infinities are "inf" and "-inf", and a negative zero is written without its sign.

function : Number(v:Float, decimals:Int) ~ String

Parameters

NameTypeDescription
vFloatthe number
decimalsIntdigits after the point

Return

TypeDescription
Stringthe text