Generated by nulang --doc. Do not edit by hand.
fn is_digit(c: Int) -> Bool
fn is_alpha(c: Int) -> Bool
fn is_alphanum(c: Int) -> Bool
fn is_space(c: Int) -> Bool
fn skip_ws(src: String, pos: Int, len: Int) -> Int
fn read_int(src: String, pos: Int, len: Int, acc: Int) -> Int
fn read_ident(src: String, pos: Int, len: Int, h: Int) -> Int
fn env_lookup(e0: Int, e1: Int, e2: Int, e3: Int, elen: Int, h: Int) -> Int
fn prec_of(c: Int) -> Int
fn opcode_of(c: Int) -> Int
fn op_name(op: Int) -> String
fn parse_cmp(src: String, p: Int, len: Int) -> Int
fn cmp_name(op: Int) -> String
fn emit_const(num: Int, reg: Int)
fn emit_binop(opcode: Int, lr: Int, rr: Int, dr: Int)
fn emit_copy(src_reg: Int, dst_reg: Int)
fn comp(src: String, pos: Int, len: Int, left: Int, min_prec: Int, nr: Int, e0: Int, e1: Int, e2: Int, e3: Int, elen: Int)
fn compile(src: String)
fn main()
fn is_digit(c: Int) -> Bool
fn is_alpha(c: Int) -> Bool
fn is_alphanum(c: Int) -> Bool
fn is_space(c: Int) -> Bool
fn skip_ws(src: String, pos: Int, len: Int) -> Int
fn read_int(src: String, pos: Int, len: Int, acc: Int) -> Int
fn read_ident(src: String, pos: Int, len: Int, h: Int) -> Int
fn env_lookup(e0: Int, e1: Int, e2: Int, e3: Int, elen: Int, h: Int) -> Int
fn prec_of(c: Int) -> Int
fn parse_cmp(src: String, p: Int, len: Int) -> Int
fn hex_digit(n: Int) -> String
fn remark(msg: String)
fn emit_hex(w: Int)
fn instr(opcode: Int, op1: Int, op2: Int, op3: Int) -> Int
fn comp(src: String, pos: Int, len: Int, left: Int, min_prec: Int, nr: Int, e0: Int, e1: Int, e2: Int, e3: Int, elen: Int) -> Int
fn compile(src: String)
fn main()
fn is_digit(c: Int) -> Bool
fn is_alpha(c: Int) -> Bool
fn is_alphanum(c: Int) -> Bool
fn is_space(c: Int) -> Bool
fn skip_ws(src: String, pos: Int, len: Int) -> Int
fn read_int(src: String, pos: Int, len: Int, acc: Int) -> Int
fn read_ident(src: String, pos: Int, len: Int, h: Int) -> Int
fn env_lookup(e0: Int, e1: Int, e2: Int, e3: Int, elen: Int, h: Int) -> Int
fn prec_of(c: Int) -> Int
fn parse_cmp(src: String, p: Int, len: Int) -> Int
fn cmp_op(op: Int, a: Int, b: Int) -> Int
fn parse_pratt(src: String, pos: Int, len: Int, left: Int, min_prec: Int, e0: Int, e1: Int, e2: Int, e3: Int, elen: Int) -> Int
fn parse(src: String) -> Int
fn main()
fn main()
fn fib(n: Int) -> Int
fn main()
fn is_digit(c: Int) -> Bool
fn is_space(c: Int) -> Bool
fn skip_ws(src: String, pos: Int, len: Int) -> Int
fn read_int(src: String, pos: Int, len: Int, acc: Int) -> Int
fn prec_of(c: Int) -> Int
fn parse_pratt(src: String, pos: Int, len: Int, left: Int, min_prec: Int) -> Int
fn parse(src: String) -> Int
fn main()
fn main()
actor Counter
fn main()
fn main()
fn name(c: Color) -> String
type Color = Red | Green | Blue
fn main()
fn main()
fn main()
fn fib(n: Int) -> Int
fn main()
fn map(arr: [Int], f: fn(Int) -> Int) -> [Int]
fn main()
fn main()
fn main()
fn main(
fn main()
fn unwrap(r: Result) -> Int
type Result = Ok(Int) | Err(String)
fn main()
fn main()
type Option[T] = Some(T) | None
fn area(s: Shape) -> Float
type Shape = Circle(Float)
fn main()
fn main()
fn main()
actor ChatAgent
fn main()
actor ChatRoom
actor ChatClient
actor Counter
fn main()
actor ChatRoom
actor ChatClient
actor Counter
fn main()
actor TcpConnection
fn main()
actor Watcher
actor Victim
fn describe_int(n: Int) -> String
fn unwrap_or(opt: Option[Int], default: Int) -> Int
fn classify(n: Int) -> String
fn describe(opt: Option[Option[Int]]) -> String
fn area(rect:
fn color_code(c: Color) -> Int
fn main()
type Option[T] = Some(T) | None
type Color = Red | Green | Blue
fn double(n: Int) -> Int
fn add_ten(n: Int) -> Int
fn is_even(n: Int) -> Bool
fn shout(s: String) -> String
fn greet(name: String) -> String
fn main()
fn main()
fn main()
actor Echo
actor MainActor
fn main()
actor Counter
actor Worker
fn main()
actor Worker
fn unwrap_or(o: Option[Int], default: Int) -> Int
type Option[T] = Some(T) | None
fn main()
actor PoolWorker
type Option[T] = Some(T) | None
type Result[Ok, Err] = Ok(Ok) | Error(Err)
pub fn map[T, U](opt: Option[T], f: fn(T) -> U) -> Option[U]
Map a function over an Option.
pub fn and_then[T, U](opt: Option[T], f: fn(T) -> Option[U]) -> Option[U]
Chain an Option-returning function.
pub fn unwrap_or[T](opt: Option[T], default: T) -> T
Extract the value or return a default.
pub fn is_some[T](opt: Option[T]) -> Bool
Returns true if the Option is Some.
pub fn is_none[T](opt: Option[T]) -> Bool
Returns true if the Option is None.
pub fn map_result[T, U, E](r: Result[T, E], f: fn(T) -> U) -> Result[U, E]
Map a function over a successful Result.
pub fn map_error[T, E, F](r: Result[T, E], f: fn(E) -> F) -> Result[T, F]
Map a function over the error case.
pub fn and_then_result[T, U, E](r: Result[T, E], f: fn(T) -> Result[U, E]) -> Result[U, E]
Chain a Result-returning function.
pub fn unwrap_or_result[T, E](r: Result[T, E], default: T) -> T
Extract the value or return a default.
pub fn is_ok[T, E](r: Result[T, E]) -> Bool
Returns true if the Result is Ok.
pub fn is_error[T, E](r: Result[T, E]) -> Bool
Returns true if the Result is Error.
pub fn id[T](x: T) -> T
Identity function. Returns its argument unchanged.
pub fn compose[A, B, C](f: fn(B) -> C, g: fn(A) -> B) -> fn(A) -> C
Function composition: (f ∘ g)(x) = f(g(x)).
pub fn const_fn[T, U](x: T, _y: U) -> T
Constant function: always returns the same value.
pub fn expect[T, E](r: Result[T, E], msg: String, default: T) -> T
Unwrap a Result, panicking with the given message on Error. Unwrap a Result, printing an error message on Error and returning a default.
pub fn or_else[T, E](r: Result[T, E], fallback: fn(E) -> T) -> T
pub fn ok_or[T, E](opt: Option[T], err: E) -> Result[T, E]
Convert an Option to a Result, using a default error on None.
pub fn flat_map[T, U, E](r: Result[T, E], f: fn(T) -> Result[U, E]) -> Result[U, E]
Apply a fallible function if the Result is Ok, otherwise propagate the error.
Shorter alias for and_then_result.
pub type Option[T] = Some(T) | None
Optional value: either Some(value) or None.
pub type Result[T, E] = Ok(T) | Error(E)
Result of a fallible operation: either Ok(value) or Error(reason).
pub fn get(url: String) -> String !
Perform an HTTP GET request. Returns the response body as a String. Requires the runtime host (not available in standalone VM).
pub fn post(url: String, body: String) -> String !
Perform an HTTP POST request with a body. Returns the response body as a String. Requires the runtime host (not available in standalone VM).
pub type HttpError = Timeout | ConnectionRefused | BadStatus(Int) | Other(String)
Error type for HTTP operations.
pub fn parse(json: String) -> JsonValue
Parse a JSON string into a JsonValue. Uses the built-in JSON.parse operation.
pub fn stringify(value: JsonValue) -> String
Convert a JsonValue back to a JSON string. Uses the built-in JSON.stringify operation.
pub fn get_string(obj: JsonValue, key: String, default: String) -> String
Get a string field from a JSON object, or return a default.
pub fn get_number(obj: JsonValue, key: String, default: Float) -> Float
Get a number field from a JSON object, or return a default.
pub fn get_bool(obj: JsonValue, key: String, default: Bool) -> Bool
Get a bool field from a JSON object, or return a default.
pub type JsonValue =
Represents a parsed JSON value.
pub fn map[T, U](arr: [T], f: fn(T) -> U) -> [U]
Map a function over every element, returning a new array.
pub fn filter[T](arr: [T], pred: fn(T) -> Bool) -> [T]
Keep elements that satisfy a predicate.
pub fn fold[T, U](arr: [T], init: U, f: fn(U, T) -> U) -> U
Reduce from the left: fold([a,b,c], init, f) = f(f(f(init,a),b),c).
pub fn append[T](left: [T], right: [T]) -> [T]
Append two arrays into a new array.
pub fn reverse[T](arr: [T]) -> [T]
Reverse an array.
pub fn nth[T](arr: [T], n: Int, default: T) -> T
Get the nth element (0-indexed), or return default if out of bounds.
pub fn take[T](arr: [T], n: Int) -> [T]
Take the first n elements.
pub fn drop[T](arr: [T], n: Int) -> [T]
Drop the first n elements.
pub fn any[T](arr: [T], pred: fn(T) -> Bool) -> Bool
Check if any element satisfies a predicate.
pub fn all[T](arr: [T], pred: fn(T) -> Bool) -> Bool
Check if all elements satisfy a predicate.
pub fn sort[T](arr: [T]) -> [T]
Sort an array using insertion sort (stable, O(n²)).
pub fn zip[T, U](left: [T], right: [U]) -> [(T, U)]
Zip two arrays into an array of pairs. Stops at the shorter length.
pub fn enumerate[T](arr: [T]) -> [(Int, T)]
Pair each element with its index: [(0, arr[0]), (1, arr[1]), ...].
pub fn range(start: Int, end: Int) -> [Int]
Generate an array of integers from start (inclusive) to end (exclusive).
pub fn group_by[T, K](arr: [T], key_fn: fn(T) -> K) -> [(K, [T])]
Group elements by a key function. Returns an array of (key, group) pairs.
pub fn empty() -> [(Int, Int)]
An empty map.
pub fn insert(map: [(Int, Int)], key: Int, v: Int) -> [(Int, Int)]
Insert a key-value pair.
pub fn get(map: [(Int, Int)], key: Int) -> Option[Int]
Look up a key.
pub fn remove(map: [(Int, Int)], key: Int) -> [(Int, Int)]
Remove a key.
pub fn contains(map: [(Int, Int)], key: Int) -> Bool
Check whether a key is present.
pub fn size(map: [(Int, Int)]) -> Int
Number of key-value pairs.
pub fn abs(x: Int) -> Int
Absolute value.
pub fn min(a: Int, b: Int) -> Int
Minimum of two integers.
pub fn max(a: Int, b: Int) -> Int
Maximum of two integers.
pub fn clamp(x: Int, lo: Int, hi: Int) -> Int
Clamp x to the range [lo, hi].
pub fn pow(base: Int, exp: Int) -> Int
Integer exponentiation (x^y) for non-negative y.
pub fn factorial(n: Int) -> Int
Factorial. Returns 1 for n <= 1.
pub fn gcd(a: Int, b: Int) -> Int
Greatest common divisor (Euclidean algorithm).
pub fn empty() -> [Int]
An empty set.
pub fn contains(set: [Int], value: Int) -> Bool
Check whether a value is in the set.
pub fn insert(set: [Int], value: Int) -> [Int]
Insert a value into the set.
pub fn remove(set: [Int], value: Int) -> [Int]
Remove a value from the set.
pub fn size(set: [Int]) -> Int
Number of elements in the set.
pub fn trim(s: String) -> String
Remove leading and trailing whitespace from a string.
pub fn length(s: String) -> Int
Get the length of a string in bytes.
pub fn is_empty(s: String) -> Bool
Check if the string is empty.
pub fn split(s: String, delim: Int) -> [String]
Split a string by a delimiter character. Returns an array of substrings.
pub fn join(parts: [String], sep: String) -> String
Join an array of strings with a separator.
pub fn replace(s: String, from: String, to: String) -> String
Replace all occurrences of from with to in a string.
pub fn to_upper(s: String) -> String
Convert a string to uppercase (ASCII letters only).
pub fn to_lower(s: String) -> String
Convert a string to lowercase (ASCII letters only).
pub fn contains(s: String, sub: String) -> Bool
Check whether s contains the substring sub.
pub fn starts_with(s: String, prefix: String) -> Bool
Check whether s starts with prefix.
pub fn ends_with(s: String, suffix: String) -> Bool
Check whether s ends with suffix.
pub fn assert_eq[T](actual: T, expected: T)
Assert that two values are equal. Prints a message and exits with an error if they differ.
pub fn assert_true(condition: Bool)
Assert that a boolean condition is true.
pub fn assert_false(condition: Bool)
Assert that a boolean condition is false.
pub fn fail(message: String)
Fail unconditionally with a message.