Skip to content

Builtins reference

Tantu's builtins are callable names available in every program, with no import needed. A few (chan, send, recv, close, sleep, print) are compiler intrinsics backed by dedicated bytecode; the rest are ordinary library functions. Referencing a builtin outside call position is a compile error; they aren't first-class values.

In the signatures below, T and U stand for any type.

NameSignatureNotes
print(T) -> Unitany value; prints via the PRINT op
str(T) -> Strrender to a string (a Str is returned unquoted)
len(List[T]) -> Int, (Str) -> Intlength; two overloads
push(List[T], T) -> List[T]returns a NEW list (lists are immutable by convention)
get(List[T], Int) -> Option[T]safe index; None when out of range
concat(List[T], List[T]) -> List[T]join two lists
range(Int, Int) -> List[Int]half-open [a, b)
float(Int) -> Floatwiden an Int
trunc(Float) -> Inttruncate toward zero
parse_int(Str) -> Option[Int]None if not an integer
split(Str, Str) -> List[Str]split on a separator
substring(Str, Int, Int) -> Strhalf-open, clamps to bounds
chars(Str) -> List[Str]explode into single-character strings
chan[T](n?)() -> Chan[T] / (Int) -> Chan[T]make a channel (optional buffer size)
send(Chan[T], T) -> Unitsend a value (blocks when full)
recv(Chan[T]) -> Option[T]receive; None when the channel is closed + drained
close(Chan[T]) -> Unitclose a channel
sleep(Int) -> Unityield for N milliseconds

Generated

This table is generated from the language's builtin registry (tantu/prelude.py) and Appendix A of the design spec, so it stays in sync with the interpreter.

See Types & no-null for how Option and Result (returned by get, parse_int, and recv) are consumed, and Collections for lists, tuples, and strings.