Built-ins & Collections
Global functions, array and map methods, string methods, and the drop intrinsic.
Global built-ins
| Name | Behaviour |
|---|---|
out(value, ...) | Print each argument followed by a newline. Concatenate with + for one line. |
string(x) | Convert any value to String; no argument gives "". |
int64(x) | Convert to Int64. |
float64(x) | Convert to Float64. |
float32(x) | Convert to Float32. |
type(x) | Return the runtime type name: "Int64", "Float64", "Float32", "String", "Array", "Map", ... |
sizeof(x) | Length of a string or array (runtime-reported size). |
sequence(lo, hi) | Generate integer values from lo up to but excluding hi. |
map() | Create an empty Map. |
free(x) | No-op on the compiled backend (arena); releases the object on the interpreter. |
drop(x) | Release a typed-array payload early when it is the arena tail. |
exit(code) | Terminate the process with the given exit code. |
out is not available on the Arduino target; use arduino.serial_print / arduino.serial_println instead.
free does not reclaim arena memory in compiled code. Use regions for reclamation. drop is the early-release primitive:
drop requires a typed Array<Float64>, Array<Float32>, or Array<Int64> variable. It is a no-op when the value is not the most recent arena allocation, and it rejects scratch arrays (VNE-084).
Array methods
Arrays and typed arrays share a method surface. Typed arrays keep the native, unboxed representation when the receiver type is known.
| Method | Meaning |
|---|---|
push(x) | Append an element |
reserve(n) | Typed numeric arrays: ensure capacity of at least n; preserve length and elements |
resize(n, fill) | Typed numeric arrays: change length; fill newly added elements; grow capacity if needed |
pop() | Remove and return the last element |
pop_front() | Remove and return the first element |
size() / length() | Element count |
clear() | Remove all elements |
reverse() | Reverse in place |
sort() | Sort in place (numeric or lexicographic by element type) |
find(x) / delete_at(i) | Locate or remove by value/index |
fill(v) | Fill every element with v |
copy_to(dst) | Copy into another typed array |
place_all(src) | Copy all elements from src |
sum() / mean() / min() / max() | Numeric reductions on typed numeric arrays |
join(sep) | Join string elements with a separator |
back() | Last element |
Membership uses in; there is no separate contains method:
Preallocated typed buffers
reserve and resize apply to Array<Float64>, Array<Float32>, and Array<Int64> in compiled desktop code. Use non-negative sizes and a fill value matching the element type. Reserving less than existing capacity does not shrink storage. Shrinking with resize does not release capacity; growing initializes only the new range. Ordinary push growth is unchanged.
Capacity growth can replace the payload. Reserve before creating borrowed Slice views, and do not grow the owner while a view is in use. Arena allocations are still subject to the region budget: preallocation reduces repeated growth, but does not bypass @bounded.
Map methods
Maps have string keys and unspecified iteration order.
| Method | Meaning |
|---|---|
set(key, value) | Insert or update |
get(key) | Read a key; missing keys yield null |
get_or(key, default) | Read a key with a fallback |
has(key) | Whether the key exists |
delete(key) | Remove a key |
keys() / values() | Key or value list |
clear() | Remove every entry |
size() / length() | Entry count |
String methods
| Method | Meaning |
|---|---|
length() / size() | UTF-8 byte length |
substr(start, len) | Substring |
byte_at(i) | Byte value at index i (integer) |
trim() | Strip leading and trailing whitespace |
uppercase() / lowercase() | Case conversion |
replace(old, new) | Replace occurrences |
split(sep) | Split into an array of strings |
Conversions and formatting
int64 saturates on out-of-range text rather than trapping. Arithmetic wraps on Int64; there is no overflow checking.