Stdlib module math/arrays.vitl

This page is a wiki-style reference for one concrete stdlib file. It explains what the file owns, where it fits in the family, and how to decide whether this is the right surface to depend on.

Visual portrait of math/arrays.vitl
Wiki-style portrait for math/arrays.vitl.

Family: math

Kind: public stdlib surface

Page style: this reference follows the same “encyclopedic card + portrait + usage contract” logic as the keyword pages, but for stdlib modules.

Summary

Overview

FieldValue
Pathmath/arrays.vitl
Familymath
Kindpublic stdlib surface
Line count640
Declared procedures83
Declared forms/picks2

`math/arrays.vitl` is a public stdlib surface inside the `math` family. It should be read as one focused slice of the broader family responsibility: Arithmetic, algebra, comparison, calculus, geometry, modular arithmetic, number theory, probability, statistics, matrix, and vector helpers.

Purpose

This file should be chosen because of responsibility, not because its name “sounds close enough”. Inside the math family, it carries one focused part of the contract and keeps that responsibility separate from neighboring concerns.

  • A scoring engine can compute aggregates in `math` while keeping I/O and transport elsewhere.
  • A statistics or matrix chapter should explain the workflow around the computation, not just a single formula.

Taxonomy

Think of this page as a generated encyclopedia entry rather than a hand-written tutorial. The goal is to show what kind of module this is, how dense it is, and what reading strategy makes sense before depending on it.

  • Large algorithm surface: this file exposes many procedures and likely acts as a domain toolkit rather than a single thin wrapper.
  • Owns domain vocabulary: the module declares data shapes in addition to executable helpers, so its types are part of the contract.
  • Minimal top-level dependencies: the module reads as mostly self-contained from its opening declarations.
  • Explicit export surface: the file ends with visible export declarations instead of relying only on implicit namespace discovery.

Implementation profile

This profile is inferred directly from the source text. It does not replace reading the file, but it tells you quickly whether the module is mostly declarative, loop-heavy, branch-heavy, or organized around many small exits.

SignalCountWhat it suggests
if49Branching density and local decision-making.
while36Loop-heavy or iterative implementation style.
for0Collection-style traversal at source level.
match0Variant-driven branching or grammar-style decoding.
let84Local state and intermediate value density.
give114Number of explicit exit points and result shaping.

Top-level API inventory

SurfaceItems
Procedureslen, is_empty, first_or, last_or, first, last, contains, index_of, count, last_index_of, copy, append
FormsRawSlice, Vec
Picksnone declared at top level
Constantsnone declared at top level
Exports*

Imported surfaces

This file does not advertise a top-level `use` surface in its opening declarations. That often means it is either self-contained or an aggregation layer.

Position in family

This file is module 4 of 21 in the math family when ordered by path. By procedure count it ranks 3, and by line count it ranks 6. Those ranks are useful as rough signals of breadth, not as quality judgments.

Declaration map

The declaration map turns raw source into a scan-friendly catalog. It is useful when the file is large enough that a reader wants to orient by kinds of surfaces first.

LineNameKindRole
1vitte/stdlib/math/arraysspaceDeclares the namespace that anchors this file in the stdlib tree.
3RawSliceformIntroduces a structured data shape that other procedures can exchange.
7VecformIntroduces a structured data shape that other procedures can exchange.
11lenprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
15is_emptyprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
19first_orprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
26last_orprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
33firstprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
34lastprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
36containsprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
47index_ofprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
58countprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
70last_index_ofprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
81copyprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
82appendprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
83prependprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
84concatprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
85pushprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
87set_atprocOwns a concrete data shape or the operations that maintain it.
104swapprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
115clearprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
117takeprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
127dropprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
140popprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
147pop_atprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
149insertprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
159remove_atprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
166repeatprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
176fillprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
178reverse_copyprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
188reverseprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
190sumprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
200minprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
215maxprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
230mean_floorprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
237mean_scaledprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
244rangeprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
251abs_intprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
258sum_absprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
268productprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
281any_nonzeroprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
292all_nonzeroprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
303count_nonzeroprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
315prefix_minprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
332prefix_maxprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
349clamp_eachprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
366prefix_sumprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
378tailprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
379headprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
381sliceprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
394rotate_leftprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
402rotate_rightprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
411replace_sliceprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
415spliceprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
419rotateprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
426enumerateprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
436zipprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
447chunksprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
460sortprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
476binary_searchprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
496map_addprocOwns a concrete data shape or the operations that maintain it.
506filter_positiveprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
518reduce_sumprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
520uniqueprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
532intersectprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
544union_valuesprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
549differenceprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
561memsetprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
562memcpyprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
564memcmpprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
585flattenprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
595repeat_arrayprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
605equalsprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
606vec_newprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
607vec_with_capacityprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
608vec_pushprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
609vec_popprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
610vec_getprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
611vec_setprocOwns a concrete data shape or the operations that maintain it.
612vec_reserveprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
613vec_shrinkprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
614sort_byprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
615qsortprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
617arrays_versionprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
618arrays_readyprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
620arrays_selftestprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.

The table is exhaustive for top-level declarations of the selected kinds. This file declares 86 matching surfaces.

Representative signatures

These signatures are shown in source order so the page keeps the feel of a reference manual, not just a keyword cloud.

  • form RawSlice { (line 3)
  • form Vec { (line 7)
  • proc len(values: [int]) -> int { (line 11)
  • proc is_empty(values: [int]) -> bool { (line 15)
  • proc first_or(values: [int], fallback: int) -> int { (line 19)
  • proc last_or(values: [int], fallback: int) -> int { (line 26)
  • proc first(values: [int]) -> int { give first_or(values, 0) } (line 33)
  • proc last(values: [int]) -> int { give last_or(values, 0) } (line 34)
  • proc contains(values: [int], needle: int) -> bool { (line 36)
  • proc index_of(values: [int], needle: int) -> int { (line 47)
  • proc count(values: [int], needle: int) -> int { (line 58)
  • proc last_index_of(values: [int], needle: int) -> int { (line 70)
  • proc copy(values: [int]) -> [int] { give values } (line 81)
  • proc append(values: [int], value: int) -> [int] { give values + [value] } (line 82)
  • proc prepend(values: [int], value: int) -> [int] { give [value] + values } (line 83)
  • proc concat(a: [int], b: [int]) -> [int] { give a + b } (line 84)
  • proc push(values: [int], value: int) -> [int] { give append(values, value) } (line 85)
  • proc set_at(values: [int], index: int, value: int) -> [int] { (line 87)

The list is intentionally capped here; the source file declares 85 matching signatures in total.

How to use this module

Start by reading the file as an ownership boundary. Ask three questions: what enters this module, what stable types or procedures it exports, and what adjacent module should stay outside of it.

  1. Read space and top-level imports first so the ownership boundary of math/arrays.vitl is explicit.
  2. Read declared forms and picks before algorithms so the data vocabulary is stable in your head.
  3. Traverse procedures in source order; the early helpers usually explain the naming and numeric conventions used later.
  4. Only after that compare neighbor modules, because the right boundary choice matters more than memorizing one helper name.

User example

This example is generated from the actual stdlib module surface. Its job is not to be the smallest snippet possible; its job is to show a realistic consumer-shaped file that exercises the module and mirrors the language keywords the module itself relies on.

space demo/math_arrays
form UserReport {
  label: string,
  ready: bool
}
proc run_example() -> UserReport {
  let entries = copy([1, 2, 3])
  let ready: bool = is_empty([1, 2, 3])
  let failed: bool = false
  let stable: bool = ready and true
  let fallback: bool = ready or false
  let idx: int = 0
  let count: int = 0
  while idx < entries.len {
    set count = count + 1
    set idx = idx + 1
  }
  if not ready {
    give UserReport { label: "not-ready", ready: false }
  } else {
    give UserReport { label: "ok", ready: true }
  }
}
export run_example

Keyword coverage

This table makes the “all keywords of the module” requirement auditable. It compares the detected Vitte keywords in the source file with the generated consumer example above.

KeywordPresent in module sourceUsed in generated user example
spaceyesyes
formyesyes
procyesyes
letyesyes
setyesyes
ifyesyes
elseyesyes
whileyesyes
giveyesyes
exportyesyes
trueyesyes
falseyesyes
andyesyes
oryesyes
notyesyes

The generated snippet exercises every detected Vitte keyword used by this module.

Source shape

space vitte/stdlib/math/arrays
form RawSlice {
  data: [int]
}
form Vec {
  data: [int]
}
proc len(values: [int]) -> int {
  give values.len
}

The excerpt is not meant to replace the file. It exists to make the module recognizable at first glance, the same way a Wikipedia infobox helps the reader orient before reading the whole article.

Source landmarks

Large files are easier to retain when they have visible landmarks. When the source contains explicit section banners, they are surfaced here; otherwise the first major declarations are used as anchors.

  • Line 1: space vitte/stdlib/math/arrays
  • Line 3: form RawSlice {
  • Line 7: form Vec {
  • Line 11: proc len(values: [int]) -> int {
  • Line 15: proc is_empty(values: [int]) -> bool {
  • Line 19: proc first_or(values: [int], fallback: int) -> int {
  • Line 26: proc last_or(values: [int], fallback: int) -> int {
  • Line 33: proc first(values: [int]) -> int { give first_or(values, 0) }

Source organization

When a file carries its own internal chaptering, those chapters usually reveal the intended reading order better than a flat symbol list. This section reconstructs that organization from the source itself.

File surfaces

Top-level items: 87. Procedures: 83. Data surfaces: 2. Constants: 0.

First visible names: vitte/stdlib/math/arrays, RawSlice, Vec, len, is_empty, first_or, last_or, first, last, contains

Complete API catalog

This catalog is the exhaustive file-level index for the module. It is intentionally closer to a generated encyclopedia appendix than to a tutorial summary.

Data surfaces

LineNameSignatureRole
3RawSliceform RawSlice {Introduces a structured data shape that other procedures can exchange.
7Vecform Vec {Introduces a structured data shape that other procedures can exchange.

Procedures

LineNameSignatureRole
11lenproc len(values: [int]) -> int {Represents one top-level surface in the file contract and should be read as part of the module boundary.
15is_emptyproc is_empty(values: [int]) -> bool {Represents one top-level surface in the file contract and should be read as part of the module boundary.
19first_orproc first_or(values: [int], fallback: int) -> int {Represents one top-level surface in the file contract and should be read as part of the module boundary.
26last_orproc last_or(values: [int], fallback: int) -> int {Represents one top-level surface in the file contract and should be read as part of the module boundary.
33firstproc first(values: [int]) -> int { give first_or(values, 0) }Represents one top-level surface in the file contract and should be read as part of the module boundary.
34lastproc last(values: [int]) -> int { give last_or(values, 0) }Represents one top-level surface in the file contract and should be read as part of the module boundary.
36containsproc contains(values: [int], needle: int) -> bool {Represents one top-level surface in the file contract and should be read as part of the module boundary.
47index_ofproc index_of(values: [int], needle: int) -> int {Represents one top-level surface in the file contract and should be read as part of the module boundary.
58countproc count(values: [int], needle: int) -> int {Represents one top-level surface in the file contract and should be read as part of the module boundary.
70last_index_ofproc last_index_of(values: [int], needle: int) -> int {Represents one top-level surface in the file contract and should be read as part of the module boundary.
81copyproc copy(values: [int]) -> [int] { give values }Represents one top-level surface in the file contract and should be read as part of the module boundary.
82appendproc append(values: [int], value: int) -> [int] { give values + [value] }Represents one top-level surface in the file contract and should be read as part of the module boundary.
83prependproc prepend(values: [int], value: int) -> [int] { give [value] + values }Represents one top-level surface in the file contract and should be read as part of the module boundary.
84concatproc concat(a: [int], b: [int]) -> [int] { give a + b }Represents one top-level surface in the file contract and should be read as part of the module boundary.
85pushproc push(values: [int], value: int) -> [int] { give append(values, value) }Represents one top-level surface in the file contract and should be read as part of the module boundary.
87set_atproc set_at(values: [int], index: int, value: int) -> [int] {Owns a concrete data shape or the operations that maintain it.
104swapproc swap(values: [int], i: int, j: int) -> [int] {Represents one top-level surface in the file contract and should be read as part of the module boundary.
115clearproc clear(values: [int]) -> [int] { give [] }Represents one top-level surface in the file contract and should be read as part of the module boundary.
117takeproc take(values: [int], count0: int) -> [int] {Represents one top-level surface in the file contract and should be read as part of the module boundary.
127dropproc drop(values: [int], count0: int) -> [int] {Represents one top-level surface in the file contract and should be read as part of the module boundary.
140popproc pop(values: [int]) -> [int] {Represents one top-level surface in the file contract and should be read as part of the module boundary.
147pop_atproc pop_at(values: [int], index: int) -> [int] { give remove_at(values, index) }Represents one top-level surface in the file contract and should be read as part of the module boundary.
149insertproc insert(values: [int], index: int, value: int) -> [int] {Represents one top-level surface in the file contract and should be read as part of the module boundary.
159remove_atproc remove_at(values: [int], index: int) -> [int] {Represents one top-level surface in the file contract and should be read as part of the module boundary.
166repeatproc repeat(value: int, count0: int) -> [int] {Represents one top-level surface in the file contract and should be read as part of the module boundary.
176fillproc fill(values: [int], value: int) -> [int] { give repeat(value, values.len) }Represents one top-level surface in the file contract and should be read as part of the module boundary.
178reverse_copyproc reverse_copy(values: [int]) -> [int] {Represents one top-level surface in the file contract and should be read as part of the module boundary.
188reverseproc reverse(values: [int]) -> [int] { give reverse_copy(values) }Represents one top-level surface in the file contract and should be read as part of the module boundary.
190sumproc sum(values: [int]) -> int {Represents one top-level surface in the file contract and should be read as part of the module boundary.
200minproc min(values: [int]) -> int {Represents one top-level surface in the file contract and should be read as part of the module boundary.
215maxproc max(values: [int]) -> int {Represents one top-level surface in the file contract and should be read as part of the module boundary.
230mean_floorproc mean_floor(values: [int]) -> int {Represents one top-level surface in the file contract and should be read as part of the module boundary.
237mean_scaledproc mean_scaled(values: [int], scale: int) -> int {Represents one top-level surface in the file contract and should be read as part of the module boundary.
244rangeproc range(values: [int]) -> int {Represents one top-level surface in the file contract and should be read as part of the module boundary.
251abs_intproc abs_int(value: int) -> int {Represents one top-level surface in the file contract and should be read as part of the module boundary.
258sum_absproc sum_abs(values: [int]) -> int {Represents one top-level surface in the file contract and should be read as part of the module boundary.
268productproc product(values: [int]) -> int {Represents one top-level surface in the file contract and should be read as part of the module boundary.
281any_nonzeroproc any_nonzero(values: [int]) -> bool {Represents one top-level surface in the file contract and should be read as part of the module boundary.
292all_nonzeroproc all_nonzero(values: [int]) -> bool {Represents one top-level surface in the file contract and should be read as part of the module boundary.
303count_nonzeroproc count_nonzero(values: [int]) -> int {Represents one top-level surface in the file contract and should be read as part of the module boundary.
315prefix_minproc prefix_min(values: [int]) -> [int] {Represents one top-level surface in the file contract and should be read as part of the module boundary.
332prefix_maxproc prefix_max(values: [int]) -> [int] {Represents one top-level surface in the file contract and should be read as part of the module boundary.
349clamp_eachproc clamp_each(values: [int], low: int, high: int) -> [int] {Represents one top-level surface in the file contract and should be read as part of the module boundary.
366prefix_sumproc prefix_sum(values: [int]) -> [int] {Represents one top-level surface in the file contract and should be read as part of the module boundary.
378tailproc tail(values: [int]) -> [int] { give drop(values, 1) }Represents one top-level surface in the file contract and should be read as part of the module boundary.
379headproc head(values: [int]) -> int { give first(values) }Represents one top-level surface in the file contract and should be read as part of the module boundary.
381sliceproc slice(values: [int], start: int, end: int) -> [int] {Represents one top-level surface in the file contract and should be read as part of the module boundary.
394rotate_leftproc rotate_left(values: [int], amount: int) -> [int] {Represents one top-level surface in the file contract and should be read as part of the module boundary.
402rotate_rightproc rotate_right(values: [int], amount: int) -> [int] {Represents one top-level surface in the file contract and should be read as part of the module boundary.
411replace_sliceproc replace_slice(values: [int], start: int, end: int, replacement: [int]) -> [int] {Represents one top-level surface in the file contract and should be read as part of the module boundary.
415spliceproc splice(values: [int], start: int, delete_count: int, replacement: [int]) -> [int] {Represents one top-level surface in the file contract and should be read as part of the module boundary.
419rotateproc rotate(values: [int], amount: int) -> [int] {Represents one top-level surface in the file contract and should be read as part of the module boundary.
426enumerateproc enumerate(values: [int]) -> [[int]] {Represents one top-level surface in the file contract and should be read as part of the module boundary.
436zipproc zip(a: [int], b: [int]) -> [[int]] {Represents one top-level surface in the file contract and should be read as part of the module boundary.
447chunksproc chunks(values: [int], size: int) -> [[int]] {Represents one top-level surface in the file contract and should be read as part of the module boundary.
460sortproc sort(values: [int]) -> [int] {Represents one top-level surface in the file contract and should be read as part of the module boundary.
476binary_searchproc binary_search(values: [int], needle: int) -> int {Represents one top-level surface in the file contract and should be read as part of the module boundary.
496map_addproc map_add(values: [int], delta: int) -> [int] {Owns a concrete data shape or the operations that maintain it.
506filter_positiveproc filter_positive(values: [int]) -> [int] {Represents one top-level surface in the file contract and should be read as part of the module boundary.
518reduce_sumproc reduce_sum(values: [int]) -> int { give sum(values) }Represents one top-level surface in the file contract and should be read as part of the module boundary.
520uniqueproc unique(values: [int]) -> [int] {Represents one top-level surface in the file contract and should be read as part of the module boundary.
532intersectproc intersect(a: [int], b: [int]) -> [int] {Represents one top-level surface in the file contract and should be read as part of the module boundary.
544union_valuesproc union_values(a: [int], b: [int]) -> [int] {Represents one top-level surface in the file contract and should be read as part of the module boundary.
549differenceproc difference(a: [int], b: [int]) -> [int] {Represents one top-level surface in the file contract and should be read as part of the module boundary.
561memsetproc memset(count0: int, value: int) -> [int] { give repeat(value, count0) }Represents one top-level surface in the file contract and should be read as part of the module boundary.
562memcpyproc memcpy(values: [int]) -> [int] { give values }Represents one top-level surface in the file contract and should be read as part of the module boundary.
564memcmpproc memcmp(a: [int], b: [int]) -> int {Represents one top-level surface in the file contract and should be read as part of the module boundary.
585flattenproc flatten(values: [[int]]) -> [int] {Represents one top-level surface in the file contract and should be read as part of the module boundary.
595repeat_arrayproc repeat_array(values: [int], count0: int) -> [int] {Represents one top-level surface in the file contract and should be read as part of the module boundary.
605equalsproc equals(a: [int], b: [int]) -> bool { give memcmp(a, b) == 0 }Represents one top-level surface in the file contract and should be read as part of the module boundary.
606vec_newproc vec_new() -> Vec { give Vec { data: [] } }Represents one top-level surface in the file contract and should be read as part of the module boundary.
607vec_with_capacityproc vec_with_capacity(capacity: int) -> Vec { give Vec { data: [] } }Represents one top-level surface in the file contract and should be read as part of the module boundary.
608vec_pushproc vec_push(v: Vec, value: int) -> Vec { give Vec { data: v.data + [value] } }Represents one top-level surface in the file contract and should be read as part of the module boundary.
609vec_popproc vec_pop(v: Vec) -> Vec { give Vec { data: pop(v.data) } }Represents one top-level surface in the file contract and should be read as part of the module boundary.
610vec_getproc vec_get(v: Vec, index: int) -> int { give first_or(slice(v.data, index, index + 1), 0) }Represents one top-level surface in the file contract and should be read as part of the module boundary.
611vec_setproc vec_set(v: Vec, index: int, value: int) -> Vec { give Vec { data: set_at(v.data, index, value) } }Owns a concrete data shape or the operations that maintain it.
612vec_reserveproc vec_reserve(v: Vec, capacity: int) -> Vec { give v }Represents one top-level surface in the file contract and should be read as part of the module boundary.
613vec_shrinkproc vec_shrink(v: Vec) -> Vec { give v }Represents one top-level surface in the file contract and should be read as part of the module boundary.
614sort_byproc sort_by(values: [int]) -> [int] { give sort(values) }Represents one top-level surface in the file contract and should be read as part of the module boundary.
615qsortproc qsort(values: [int]) -> [int] { give sort(values) }Represents one top-level surface in the file contract and should be read as part of the module boundary.
617arrays_versionproc arrays_version() -> string { give "max-1" }Represents one top-level surface in the file contract and should be read as part of the module boundary.
618arrays_readyproc arrays_ready() -> bool { give true }Represents one top-level surface in the file contract and should be read as part of the module boundary.
620arrays_selftestproc arrays_selftest() -> bool {Represents one top-level surface in the file contract and should be read as part of the module boundary.

Exports

LineNameSignatureRole
640*export *Re-exports surfaces that the module wants to expose as part of its public boundary.

Integration boundaries

Within math, this file should remain focused. If a future helper changes the host boundary, scheduling boundary, or data-shape boundary, it probably belongs in a neighbor module instead of being added here by convenience.

  • Family responsibility: Arithmetic, algebra, comparison, calculus, geometry, modular arithmetic, number theory, probability, statistics, matrix, and vector helpers.
  • Family architecture role: Use `math` when the transformation itself is the feature. This family exists so algorithmic intent stays visible and testable.

Composition guidance

Choose this module when

  • Choose math/arrays.vitl when the main question is owned by this module rather than by transport, storage, orchestration, or user-interface code.
  • A scoring engine can compute aggregates in `math` while keeping I/O and transport elsewhere.
  • A statistics or matrix chapter should explain the workflow around the computation, not just a single formula.

Pause before extending it when

  • Avoid extending this file when the new helper mostly changes the boundary to host I/O, runtime coordination, or foreign integration instead of staying inside math.
  • Check nearby modules such as math/algebra.vitl, math/arithmetic.vitl, math/calculus.vitl before adding convenience wrappers here.

Relationship table

This table keeps the page closer to a real encyclopedia entry: a module is easier to understand when compared with its nearest alternatives in the same family.

NeighborProceduresData surfacesWhy compare it
math/algebra.vitl140Shares the same family boundary but carries a distinct slice of responsibility.
math/arithmetic.vitl722Shares the same family boundary but carries a distinct slice of responsibility.
math/calculus.vitl563Shares the same family boundary but carries a distinct slice of responsibility.
math/comparison.vitl470Shares the same family boundary but carries a distinct slice of responsibility.
math/complex.vitl490Shares the same family boundary but carries a distinct slice of responsibility.
math/geometry.vitl720Shares the same family boundary but carries a distinct slice of responsibility.
math/logic.vitl200Shares the same family boundary but carries a distinct slice of responsibility.
math/matrix.vitl530Shares the same family boundary but carries a distinct slice of responsibility.

Neighbor modules