Language Runtime

Built-ins

Tea exposes a small set of global `@` intrinsics for output, script control, introspection, and math.

Exported functions

@print(value: Any) -> Void

Write the string representation of a value to stdout.

@println(value: Any) -> Void

Write the string representation of a value to stdout with a newline.

@append(list: List[T], value: T) -> Void

Append a value to a mutable list in place.

@to_string(value: Any) -> String

Convert any value to its string representation.

@type_of(value: Any) -> String

Return the runtime type name of a value as a string.

@panic(message: String) -> Void

Terminate the program immediately with an error message.

@exit(code: Int) -> Void

Exit the program with the specified exit code.

@args() -> List

Return command-line arguments as a list of strings.

@read_line() -> String

Read a single line from stdin (without trailing newline).

@read_all() -> String

Read all content from stdin as a string.

@eprint(value: Any) -> Void

Print a value to stderr without a trailing newline.

@eprintln(value: Any) -> Void

Print a value to stderr with a trailing newline.

@is_tty() -> Bool

Return true if stdin is connected to an interactive terminal.

@len(value: Any) -> Int

Return the number of elements in a String, List, or Dict.

@floor(value: Float) -> Int

Round a float down to the nearest integer.

@ceil(value: Float) -> Int

Round a float up to the nearest integer.

@round(value: Float) -> Int

Round a float to the nearest integer.

@abs(value: Float) -> Float

Return the absolute value of a float.

@sqrt(value: Float) -> Float

Return the square root of a float.

@max(left: Float, right: Float) -> Float

Return the maximum of two floats.

@min(left: Float, right: Float) -> Float

Return the minimum of two floats.