Choose a numeric type
| Family | Types | Arithmetic |
|---|---|---|
| Unsigned integers | u8, u16, u32, u64, u128 | Exact, with overflow checks |
| Signed integers | i8, i16, i32, i64, i128 | Exact, with overflow checks |
| Binary floats | f16, f32, f64, f128 | Rounded at the declared precision; finite values only |
Results
No output.
- Executed source spans appear here.
A literal takes its type from a field, argument, return type, binding annotation,
or typed operand. Without numeric context, it defaults to f64; Number is a
compatibility spelling of f64. Use value.convert[T]() for an explicit checked
conversion. It returns Res[T, DataError]; overflow, fractional float-to-integer
conversion, and lost precision are data errors.
Use data methods
Data operations belong to the value they read or transform. The fixture prints
3, Some(2), [2, 2], 10, 255, and café. Change the final byte and
Run to see Bin.decode() return a matchable DataError instead of an exception.
Results
No output.
- Executed source spans appear here.
| Receiver | Methods |
|---|---|
Str | len(), utf8(), get(index) -> Opt[Str] |
Bin | len(), decode() -> Res[Str, DataError], get(index) -> Opt[u8] |
List[T] | len(), append(value), get(index) -> Opt[T] |
Tensor[T] | len(), shape(), reshape(...), transpose(...), sum(), matmul(...), get(indices), convert[U]() |
Str is immutable UTF-8 text and Bin is immutable bytes. Str.utf8() makes
the encoding boundary explicit; Bin.decode() checks it. get returns Some
or None for an absent index. Global len, utf8, decode, append,
shape, reshape, transpose, sum, matmul, and convert calls are not
part of the language API. print, range, and tensor constructors remain
top-level operations; tensor[T](values, shape) returns a checked
Res[Tensor[T], DataError].
Checked operations return values the caller can match or propagate. A failed runtime operation never silently wraps or substitutes a value; a failed action or lifecycle transaction preserves the previously accepted state.