reference
Mutant Playground Examples
Browser-safe learning snippets for the Mutant playground and quick local testing.
Context Rail
Tags and Themes
On This Page
Mutant Playground Examples
Purpose
These examples are designed for teaching and quick experimentation. They are grouped by feature and can be copied into the browser playground.
Expressions And Output
2 + 40
putln("Mutant WASM REPL")
putf("score=%d, mode=%s", 98, "sandbox")
Collections
putln(first([10, 20, 30]))
putln(last([10, 20, 30]))
putln(rest([10, 20, 30]))
putln(len([10, 20, 30, 40]))
JSON
let obj = {"tool": "mutant", "ok": true}
putln(json_stringify(obj))
Builtin Help
help()
Notes
- If a snippet fails in browser mode, verify whether the builtin is restricted by sandbox policy.
- For browser runtime capability details and API contracts, see
/docs/reference/wasm_repl_reference. - Keep examples small and composable; stack them as you learn each feature.