code wiki / (root) / vec.nx

vec.nx

buildroot/runtime/vec.nx

2865 B104 linesdepth 3pulls 3 transitivereach 1 importersview sourcekind librarytopic vec
docsdependenciesstructsconstsfunctions

about

vec.nx -- dynamic-array of i64 (Phase G7 in the roadmap). Specialised to i64 for now; generics will generalise to Vec<T> once parse.nx grows multi-param + full monomorphization support. That migration is API-compatible: rename occurrences of i64 in element positions only. Growth: geometric 2x on push (classical amortized O(1)). Backing storage via sys_mmap; never freed (compiler run-once, servers long-running will switch to a per-request arena later). No bounds-check-on-get to match kernel-code convention; call vec_get only after checking vec_len.

dependencies 1 imports · 1 importers

syscalls.nx vec.nx vec_test.nx

imports: syscalls.nx

imported by: vec_test.nx

structs

17struct Vec {

consts

none

functions

25func vec_new(initial_cap: i64) -> *Vec {
called by 1: main
38func vec_len(v: *Vec) -> i64 {
called by 1: main
43func vec_get(v: *Vec, i: i64) -> i64 {
called by 1: main
48func vec_set(v: *Vec, i: i64, x: i64) -> i64 {
called by 1: main
56func vec_grow(v: *Vec, want: i64) -> i64 {
called by 1: vec_push
72func vec_push(v: *Vec, x: i64) -> i64 {
called by 1: main calls 1: vec_grow
83func vec_pop(v: *Vec) -> i64 {
called by 1: main
91func vec_truncate(v: *Vec, n: i64) -> i64 {
called by 1: main
97func vec_index_of(v: *Vec, needle: i64) -> i64 {
called by 1: main