Standard Library
The standard library is built into the runtime — no imports needed. Here's the complete reference.
Built-in Functions
| Function | Description | Example |
print(...) | Output values to stdout, space-separated | print("hello", 42) |
str(val) | Convert any value to string | str(42) → "42" |
len(val) | Length of string, list, or object | len("hi") → 2 |
time() | Current Unix timestamp (float seconds) | t = time() |
sleep(ms) | Pause execution (returns Promise) | await sleep(1000) |
fetch(url) | HTTP GET (returns Promise, async) | body = await fetch(url) |
spawn(fn, ...) | Spawn a function on the event loop | p = spawn("fun", 1, 2) |
String Methods
| Method | Result | Description |
.len() | number | Length of the string |
.upper() | string | Uppercase conversion |
.lower() | string | Lowercase conversion |
.trim() | string | Trim leading/trailing whitespace |
.starts_with(s) | bool | Check prefix |
.ends_with(s) | bool | Check suffix |
.contains(s) | bool | Check substring |
.replace(from, to) | string | Replace all occurrences |
.split(delim) | list | Split into list of strings |
.repeat(n) | string | Repeat n times |
.slice(start, end) | string | Extract substring |
.index_of(s) | number | First occurrence position (or -1) |
.to_number() | number | Parse as float (0 on failure) |
.is_empty() | bool | Check if empty string |
.chars() | list | Split into character list |
Number Methods
| Method | Result | Description |
.to_string() | string | Format as string |
.ceil() | number | Round up |
.floor() | number | Round down |
.round() | number | Round to nearest integer |
.abs() | number | Absolute value |
.sqrt() | number | Square root |
.pow(n) | number | Raise to power n |
.is_integer() | bool | Check if integer value |
.to_int() | number | Truncate fractional part |
Object Methods
| Method | Result | Description |
.keys() | list | List of field names |
.values() | list | List of field values |
.entries() | list | List of [key, value] pairs |
.has(key) | bool | Check if field exists |
.len() | number | Number of fields |
List Methods
| Method | Result | Description |
.map(fn) | list | Transform each element |
.filter(fn) | list | Keep elements matching predicate |
.reduce(init, fn) | any | Accumulate left-to-right |
.each(fn) | self | Side-effect iteration |
.find(fn) | any | First matching element |
.some(fn) | bool | Any element matches? |
.every(fn) | bool | All elements match? |
.includes(val) | bool | Value in list? |
.index_of(val) | number | Find position (or -1) |
.sorted() | list | Numeric sort |
.reversed() | list | Reverse order |
.slice(start, end) | list | Extract sublist |
.concat(list) | list | Append another list |
.flatten() | list | Flatten one level |
.take(n) | list | First n elements |
.drop(n) | list | Drop first n elements |
.unique() | list | Remove adjacent duplicates |
Operators
| Operator | Description |
+ - * / % | Arithmetic (+ coerces numbers to strings) |
+= -= *= /= %= | Compound assignment |
== != < <= > >= | Comparison |
and / or / not | Boolean logic (short-circuit) |
.. | Range literal |
. | Field access / method call |
or | Failure fallback |
except { ... } | Failure pattern matching |