Documentation channel: current development main at compiler checkpoint 1d7e15e. The latest tagged release is v0.0.3; pages identify APIs that are not yet released.
Collections
Dynamic arrays are built into the language. Other standard collections use explicit modules. The common unordered containers are the default fast choices; ordered variants are explicit when iteration order matters.
Modules and container types
| Module | Type | Semantics |
|---|---|---|
| Core | T[] | Contiguous dynamic array. vector<T> is a compatibility spelling. |
<deque> | deque<T> | Double-ended sequence. |
<list> | list<T> | Linked sequence. |
<map> | map<K,V> | Hash map; average O(1) lookup/insert. |
<set> | set<T> | Hash set; average O(1) membership/insert. |
<ordered_map> | ordered_map<K,V> | Sorted tree map; O(log n) lookup/insert. |
<ordered_set> | ordered_set<T> | Sorted tree set; O(log n) lookup/insert. |
<queue> | queue<T> | FIFO queue. |
<stack> | stack<T> | LIFO stack. |
<priority_queue> | priority_queue<T> | Max-first priority queue by default. |
<tuple> | tuple<T...> | Fixed heterogeneous product value. |
Dynamic arrays
int[] a := [1, 2, 3];
int[] b := [4, 5, 6];
b.push(7);
print(b[0]);
T[] is the preferred dynamic-array spelling and requires no include. Existing vector<T> source remains compatible.
Maps and sets
map and set are the general-purpose hash-based choices. They do not promise sorted iteration order. Use the ordered_* types when order is part of the program contract.
include <map>;
include <set>;
include <ordered_map>;
map<string, int> counts := [
"users": 10,
"jobs": 4
];
counts.insert("workers", 2);
set<string> tags;
tags.insert("native");
ordered_map<string, int> sorted_counts;
Hash containers accept key/element types with a defined Strut hash. Unsupported types are rejected by semantic analysis rather than leaking backend template diagnostics.
Deque and list
include <deque>;
include <list>;
deque<int> work;
work.push(2);
work.push_front(1);
work.pop_front();
list<string> names;
names.push("b");
names.push_front("a");
Queue and stack
include <queue>;
include <stack>;
queue<int> fifo;
fifo.push(1);
fifo.push(2);
print(fifo.front());
fifo.pop();
stack<int> lifo;
lifo.push(1);
lifo.push(2);
print(lifo.top());
Priority queues
priority_queue<T> is max-first, matching the familiar C++ semantics. Add the min policy for a min-first queue.
include <priority_queue>;
priority_queue<int> largest;
largest.push(5);
largest.push(20);
print(largest.top()); // 20
priority_queue<int, min> smallest;
smallest.push(5);
smallest.push(20);
print(smallest.top()); // 5
Tuples
Tuples can be heterogeneous and may contain one or more elements. A one-element tuple uses a trailing comma so ordinary parentheses remain grouping syntax.
include <tuple>;
tuple<double, int> t := (2.0, 1);
tuple<int> one := (7,);
x := t[0];
y := t[1];
Tuple indices are compile-time integer literals so each access has a statically known result type.
Higher-order vector operations
int[] values := [1, 2, 3, 4];
squares := values.map((x) => x * x);
even := values.filter((x) => x % 2 == 0);
sum := values.reduce(0, (total, x) => total + x);
has_large := values.any((x) => x > 100);
all_positive := values.all((x) => x > 0);
first_even := values.find((x) => x % 2 == 0);
count_even := values.count((x) => x % 2 == 0);
Grouping helpers
by_role := users.count_by((user) => user.role);
by_id := users.index_by((user) => user.id);
groups := users.partition((user) => user.active);
