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
Mirrored from crates/plumc/src/lib.rs's STDLIB_COLLECTIONS_SRC, character for character. Map is a real hash map, so the mirror has to be exact in one way that is easy to miss: bucket index is String.hash(..) % bucket_count, which means Map.keys and Map.values enumerate in HASH order. A hash that disagreed with the real compiler's would print the same map in a different order See @plum_str_hash_raw in runtime.plum, and the sign-bit mask that a first attempt got wrong.
struct JsonEntry
Mirrored from crates/plumc/src/lib.rs's STDLIB_JSON_SRC, minus its own chars_of (the runtime already provides that one, since it is the single thing this prelude cannot write in Plum). Everything else is character-for-character the real compiler's, so the two agree on number formatting, escape handling and parse errors by construction rather than by inspection.
enum JsonValue
A parsed JSON document.
Faithful to what was written: numbers are all Float, since JSON has one number type. use Json; brings in decoders that turn one of these into your own types.
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.
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.