All built-in functions, grouped by category.
| Function | Signature | Notes |
|---|---|---|
print | (s: str) -> unit | Replay-safe; written once even across resumes |
net_fetch | (url: str) -> str | Records body to log; replay does not hit network |
now | () -> int | Records first call; replay returns same value |
random_int | (lo: int, hi: int) -> int | Records; replay returns same value |
read_file | (path: str) -> str | Records content; file can be deleted after |
write_file | (path: str, content: str) -> unit | Replay-safe; written once |
wait_until | (target_ms: int) -> unit | Pauses until now() >= target_ms |
wait_for | (name: str) -> any | Pauses until pen resume --event name=val |
| Function | Signature |
|---|---|
str_length | (s: str) -> int |
str_slice | (s: str, start: int, end: int) -> str |
to_str | (x: any) -> str |
| Function | Signature | Notes |
|---|---|---|
list_new | (...elems) -> list | Varargs |
list_push | (l: list, x: any) -> list | Returns new list (immutable) |
list_get | (l: list, i: int) -> any | Throws on out-of-bounds |
list_set | (l: list, i: int, x: any) -> list | Returns new list (immutable) |
list_len | (l: list) -> int |
| Function | Signature | Notes |
|---|---|---|
dict_new | () -> dict | Empty dict |
dict_set | (d: dict, k: str, v: any) -> dict | Returns new dict (immutable) |
dict_get | (d: dict, k: str) -> any | Throws on missing key |
dict_has | (d: dict, k: str) -> bool | |
dict_keys | (d: dict) -> list[str] | Sorted |
| Op | Type | Notes |
|---|---|---|
+ | (int, int) → int; (str, str) → str | Overloaded |
- * / | (int, int) → int | Integer arithmetic; div truncates |
< > <= >= | (int, int) → bool | |
== != | (T, T) → bool | Structural for list/dict; throws on closures |