Standard Library Overview
Kira's standard library is organized into focused modules.
| Module | Description |
|---|---|
std.io | Console I/O (print, println, read_line) |
std.fs | File system (read_file, write_file, exists) |
std.list | List operations (map, filter, fold, length, reverse) |
std.option | Optional value operations |
std.result | Error handling operations |
std.string | String manipulation (split, trim, contains, replace) |
std.builder | Efficient string building |
std.map | Hash maps (get, put, contains, new) |
std.char | Character operations |
std.math | Mathematical operations |
std.time | Time operations (now, sleep, elapsed) |
std.assert | Testing assertions |
Built-in Functions
These functions are available without importing:
| Function | Description |
|---|---|
to_string(x) | Convert any value to a string |
to_int(s) | Parse string to integer |
to_float(s) | Parse string to float |
type_of(x) | Get the type name of a value |
abs(n) | Absolute value |
min(a, b) | Minimum of two values |
max(a, b) | Maximum of two values |
len(x) | Length of a collection |
assert(cond) | Assert a condition is true |
Importing
// Import entire module
import std.list
// Import specific items
import std.list.{ map, filter, fold }
// Import with alias
import std.list.{ map as list_map }