Skip to content

Builtins

functiontypenotes
print(x, ...)()prints values separated by spaces. Contexts can’t be printed
len(s)inttokens (bytes) of a string, or length of a list
contains(s, sub)boolsubstring test
to_str(x)str<=24int, float, or bool to string
trim(s)same as sstrip whitespace
functionresult
rand_uniform([d, ...], lo, hi, seed)f32 tensor, uniform in [lo, hi]. lo/hi must be constants
zeros([d, ...])f32 zeros
quant(t, fmt)t quantized to fmt (values kept dequantized for compute)
matmul(a, b), a @ b2-D matrix product, f32 accumulation
add(a, b), a + b, a - belementwise, with row broadcast
scale(t, c), t * cmultiply by a constant
relu(t), silu(t)activations
measured_err(t)float: measured ‖computed − exact‖∞
report(t)prints shape, format, measured vs static magnitude and error

x |> f is sugar for f(x), and x |> f(a) for f(x, a).