#root
data root/data/data.vi
Data structures.
List root/data/List.vi
struct List[T](...);
A linear collection of T.
Lists are optimized for fast concatenation and in-order iteration. Accessing the first value in a list is O(1), but accessing an arbitrary value is O(n).
let list = [1, 2, 3]; list.push_front(0); list // [0, 1, 2, 3] list.push_back(4); list // [0, 1, 2, 3, 4] list ++= [5, 6]; list // [0, 1, 2, 3, 4, 5, 6] list.pop_front() // Some(0) list // [1, 2, 3, 4, 5, 6] for value in list.iter() { io.println("{value}"); // prints 1, 2, 3, 4, 5, 6 }
If frequently accessing elements by index, consider using an array instead.
Array root/data/Array.vi
struct Array[T](...);
A contiguous, indexed collection of T.
Values can be efficiently accessed by index, and added/removed from the beginning/end of the array.
Iterating over all of the values is less efficient; if this is being done regularly, consider using a List[T] instead.
Map root/data/Map.vi
struct Map[K, V](...);
Set root/data/Set.vi
struct Set[T](...);
Heap root/data/Heap.vi
struct Heap[T](...);
A min-heap, which provides efficient access to the smallest value in the heap.
Iterator root/data/Iterator.vi
trait Iterator[Self, Item];