prelude
let print (s: String): Unit
Writes to standard output with NO trailing newline. println is the one that adds one.
struct Zipped
A named struct, not a tuple, exactly as the real prelude has it.
let assert (cond: Bool): Unit
Stops the program unless cond holds.
For a condition the code depends on, not for input validation: there is no way to catch this.
let assert_eq (a: T) (b: T): Unit
Stops the program unless the two are equal, printing BOTH — which is the difference from assert(a == b) and the reason to prefer it in a test.
let assert_ne (a: T) (b: T): Unit
Stops the program if the two are equal, printing them.
struct MapEntry
One key and value stored in a map bucket.
struct JsonEntry
An object member, with a decoded key and JSON value.
enum JsonValue
A parsed JSON document.
Numbers are binary64 Floats and may lose precision when parsed. use Json; brings in decoders that turn one of these into your own types; Json.int rejects values outside the safe integer range.
struct ParseResult
What a JSON parse step consumed: a value, and where to carry on from. Public because the parser's own pieces return it; a caller wants json_parse.
let json_parse (s: String): Result[JsonValue, String]
Parses JSON text.
Err with a message naming what was expected. Accepts one complete value and rejects trailing text after it. Object member names must be unique within each object, compared after decoding escapes; duplicate names return Err("duplicate object member name"). Strings support JSON escapes, including UTF-16 surrogate pairs, and reject raw control characters and unpaired surrogates. Numbers must follow JSON syntax (no leading zeros). At most 128 arrays/objects may be nested, counting the root container; a deeper container returns Err("JSON nesting limit exceeded (128)"). Input bytes and decoded strings use linear storage; this is not a total input-size limit. Wide objects still compare each key against preceding keys to reject duplicates.
let json_stringify (v: JsonValue): String
Renders a JsonValue as compact JSON — no spaces, no newlines.
Object keys come out in the order they are held, which for a parsed document is the order they were read. All U+0000–U+001F control characters are escaped, including in keys. Output construction takes linear time and space in the output size, with an explicit traversal stack proportional to nesting depth instead of native stack recursion.
let hash (self: T): Int
A non-negative structural hash. Equal values hash identically, including both signs of floating-point zero. Structs, tuples, enums and arrays hash their contents; references hash their identity. Requires Hash. Does not allocate temporary text. Not cryptographic or stable across releases; do not persist it. NaN still follows IEEE equality and is unsuitable as a Map key or Set member, including inside aggregates.
Implemented by the compiler itself, so it has no Plum source to read.
let to_string (self: T): String
Renders any value as text. Every type has one, including structs, enums and arrays, so it is the fallback whenever a value has to be shown. ${x} in an interpolated string calls it.
Written x.to_string(). It is a METHOD on every value rather than a free function, so there is no to_string(x) spelling and no one type it belongs to.
Implemented by the compiler itself, so it has no Plum source to read.
let args (): Array[String]
The process's command-line arguments, program name first, exactly as the OS gave them.
Implemented by the compiler itself, so it has no Plum source to read.
let chars_of (s: String): Array[String]
The string split into one entry per CHARACTER, not per byte. This is the boundary-correct way to walk text.
Implemented by the compiler itself, so it has no Plum source to read.
let panic_raw (message: String): Unit
Prints message and exits non-zero. This is the only non-zero exit Plum exposes; assert and friends are built on it.
Implemented by the compiler itself, so it has no Plum source to read.