Stdlib module math/sequences.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/sequences.vitl
Wiki-style portrait for math/sequences.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/sequences.vitl
Familymath
Kindpublic stdlib surface
Line count670
Declared procedures56
Declared forms/picks0

`math/sequences.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.
  • 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
if47Branching density and local decision-making.
while20Loop-heavy or iterative implementation style.
for0Collection-style traversal at source level.
match0Variant-driven branching or grammar-style decoding.
let88Local state and intermediate value density.
give102Number of explicit exit points and result shaping.

Top-level API inventory

SurfaceItems
Proceduresabs_int, max_int, min_int, clamp_non_negative, pow_int, integer_sqrt, is_perfect_square, arithmetic_term, arithmetic_last, arithmetic_sum, arithmetic_mean, arithmetic_series
Formsnone declared at top level
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 16 of 21 in the math family when ordered by path. By procedure count it ranks 9, and by line count it ranks 5. 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/sequencesspaceDeclares the namespace that anchors this file in the stdlib tree.
11abs_intprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
19max_intprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
27min_intprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
35clamp_non_negativeprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
43pow_intprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
63integer_sqrtprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
82is_perfect_squareprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
95arithmetic_termprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
102arithmetic_lastprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
110arithmetic_sumprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
120arithmetic_meanprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
127arithmetic_seriesprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
144geometric_termprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
151geometric_lastprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
159geometric_sumprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
174geometric_seriesprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
191triangular_termprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
199triangular_sumprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
206triangular_seriesprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
219is_triangularprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
227square_termprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
234square_seriesprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
247cube_termprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
254cube_seriesprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
267polygonal_termprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
283pentagonal_termprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
287hexagonal_termprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
291polygonal_seriesprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
308fibonacci_termprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
335fibonacci_sumprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
343fibonacci_seriesprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
356is_fibonacciprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
367lucas_termprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
394lucas_seriesprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
407pell_termprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
434pell_seriesprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
451factorialprocImplements a counting or probability helper inside the math boundary.
467double_factorialprocImplements a counting or probability helper inside the math boundary.
487catalan_termprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
499catalan_seriesprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
516harmonic_numerator_termprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
523harmonic_denominator_termprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
530harmonic_denominatorsprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
547alternating_signprocImplements a security-sensitive transformation in the crypto boundary.
559alternating_arithmetic_termprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
566alternating_geometric_termprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
577first_arithmetic_geprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
597first_geometric_geprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
621fibprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
625lucasprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
629triangularprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
633squareprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
637cubeprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
641sequences_versionprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
645sequences_readyprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
649sequences_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 57 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.

  • proc abs_int(x: int) -> int { (line 11)
  • proc max_int(a: int, b: int) -> int { (line 19)
  • proc min_int(a: int, b: int) -> int { (line 27)
  • proc clamp_non_negative(x: int) -> int { (line 35)
  • proc pow_int(base: int, exponent: int) -> int { (line 43)
  • proc integer_sqrt(value: int) -> int { (line 63)
  • proc is_perfect_square(value: int) -> bool { (line 82)
  • proc arithmetic_term(first: int, step: int, index: int) -> int { (line 95)
  • proc arithmetic_last(first: int, step: int, count: int) -> int { (line 102)
  • proc arithmetic_sum(first: int, step: int, count: int) -> int { (line 110)
  • proc arithmetic_mean(first: int, step: int, count: int) -> int { (line 120)
  • proc arithmetic_series(first: int, step: int, count: int) -> [int] { (line 127)
  • proc geometric_term(first: int, ratio: int, index: int) -> int { (line 144)
  • proc geometric_last(first: int, ratio: int, count: int) -> int { (line 151)
  • proc geometric_sum(first: int, ratio: int, count: int) -> int { (line 159)
  • proc geometric_series(first: int, ratio: int, count: int) -> [int] { (line 174)
  • proc triangular_term(index: int) -> int { (line 191)
  • proc triangular_sum(count: int) -> int { (line 199)

The list is intentionally capped here; the source file declares 56 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/sequences.vitl is explicit.
  2. Traverse procedures in source order; the early helpers usually explain the naming and numeric conventions used later.
  3. Use the source landmarks section below as a table of contents when the file is large.
  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_sequences
proc run_example() -> string {
  let entries = arithmetic_series(1, 1, 1)
  let ready: bool = is_perfect_square(1)
  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 ready {
    give "not-ready"
  } else {
    give "ok"
  }
}
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
procyesyes
letyesyes
setyesyes
ifyesyes
elseyesyes
whileyesyes
giveyesyes
exportyesyes
trueyesyes
falseyesyes
andyesyes
oryesyes

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

Source shape

space vitte/stdlib/math/sequences
proc abs_int(x: int) -> int {
  if x < 0 {
    give -x
  } else {
    give x
  }
}
proc max_int(a: int, b: int) -> int {
  if a > b {

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.

  • Sequences — ultra complete module
  • Internal helpers
  • Arithmetic progression
  • Geometric progression
  • Triangular / square / cube / polygonal
  • Fibonacci / Lucas / Pell
  • Factorial family
  • Harmonic numbers
  • Alternating / sign helpers
  • Bounds / search helpers on sequences

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.

Opening declarations

Top-level items: 1. Procedures: 0. Data surfaces: 0. Constants: 0.

First visible names: vitte/stdlib/math/sequences

Internal helpers

Top-level items: 7. Procedures: 7. Data surfaces: 0. Constants: 0.

First visible names: abs_int, max_int, min_int, clamp_non_negative, pow_int, integer_sqrt, is_perfect_square

Arithmetic progression

Top-level items: 5. Procedures: 5. Data surfaces: 0. Constants: 0.

First visible names: arithmetic_term, arithmetic_last, arithmetic_sum, arithmetic_mean, arithmetic_series

Geometric progression

Top-level items: 4. Procedures: 4. Data surfaces: 0. Constants: 0.

First visible names: geometric_term, geometric_last, geometric_sum, geometric_series

Triangular / square / cube / polygonal

Top-level items: 12. Procedures: 12. Data surfaces: 0. Constants: 0.

First visible names: triangular_term, triangular_sum, triangular_series, is_triangular, square_term, square_series, cube_term, cube_series, polygonal_term, pentagonal_term

Fibonacci / Lucas / Pell

Top-level items: 8. Procedures: 8. Data surfaces: 0. Constants: 0.

First visible names: fibonacci_term, fibonacci_sum, fibonacci_series, is_fibonacci, lucas_term, lucas_series, pell_term, pell_series

Factorial family

Top-level items: 4. Procedures: 4. Data surfaces: 0. Constants: 0.

First visible names: factorial, double_factorial, catalan_term, catalan_series

Harmonic numbers

Top-level items: 3. Procedures: 3. Data surfaces: 0. Constants: 0.

First visible names: harmonic_numerator_term, harmonic_denominator_term, harmonic_denominators

Alternating / sign helpers

Top-level items: 3. Procedures: 3. Data surfaces: 0. Constants: 0.

First visible names: alternating_sign, alternating_arithmetic_term, alternating_geometric_term

Bounds / search helpers on sequences

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

First visible names: first_arithmetic_ge, first_geometric_ge

Public aliases

Top-level items: 9. Procedures: 8. Data surfaces: 0. Constants: 0.

First visible names: fib, lucas, triangular, square, cube, sequences_version, sequences_ready, sequences_selftest, *

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.

Procedures

LineNameSignatureRole
11abs_intproc abs_int(x: int) -> int {Represents one top-level surface in the file contract and should be read as part of the module boundary.
19max_intproc max_int(a: int, b: int) -> int {Represents one top-level surface in the file contract and should be read as part of the module boundary.
27min_intproc min_int(a: int, b: int) -> int {Represents one top-level surface in the file contract and should be read as part of the module boundary.
35clamp_non_negativeproc clamp_non_negative(x: int) -> int {Represents one top-level surface in the file contract and should be read as part of the module boundary.
43pow_intproc pow_int(base: int, exponent: int) -> int {Represents one top-level surface in the file contract and should be read as part of the module boundary.
63integer_sqrtproc integer_sqrt(value: int) -> int {Represents one top-level surface in the file contract and should be read as part of the module boundary.
82is_perfect_squareproc is_perfect_square(value: int) -> bool {Represents one top-level surface in the file contract and should be read as part of the module boundary.
95arithmetic_termproc arithmetic_term(first: int, step: int, index: int) -> int {Represents one top-level surface in the file contract and should be read as part of the module boundary.
102arithmetic_lastproc arithmetic_last(first: int, step: int, count: int) -> int {Represents one top-level surface in the file contract and should be read as part of the module boundary.
110arithmetic_sumproc arithmetic_sum(first: int, step: int, count: int) -> int {Represents one top-level surface in the file contract and should be read as part of the module boundary.
120arithmetic_meanproc arithmetic_mean(first: int, step: int, count: int) -> int {Represents one top-level surface in the file contract and should be read as part of the module boundary.
127arithmetic_seriesproc arithmetic_series(first: int, step: int, count: int) -> [int] {Represents one top-level surface in the file contract and should be read as part of the module boundary.
144geometric_termproc geometric_term(first: int, ratio: int, index: int) -> int {Represents one top-level surface in the file contract and should be read as part of the module boundary.
151geometric_lastproc geometric_last(first: int, ratio: int, count: int) -> int {Represents one top-level surface in the file contract and should be read as part of the module boundary.
159geometric_sumproc geometric_sum(first: int, ratio: int, count: int) -> int {Represents one top-level surface in the file contract and should be read as part of the module boundary.
174geometric_seriesproc geometric_series(first: int, ratio: int, count: int) -> [int] {Represents one top-level surface in the file contract and should be read as part of the module boundary.
191triangular_termproc triangular_term(index: int) -> int {Represents one top-level surface in the file contract and should be read as part of the module boundary.
199triangular_sumproc triangular_sum(count: int) -> int {Represents one top-level surface in the file contract and should be read as part of the module boundary.
206triangular_seriesproc triangular_series(count: int) -> [int] {Represents one top-level surface in the file contract and should be read as part of the module boundary.
219is_triangularproc is_triangular(value: int) -> bool {Represents one top-level surface in the file contract and should be read as part of the module boundary.
227square_termproc square_term(index: int) -> int {Represents one top-level surface in the file contract and should be read as part of the module boundary.
234square_seriesproc square_series(count: int) -> [int] {Represents one top-level surface in the file contract and should be read as part of the module boundary.
247cube_termproc cube_term(index: int) -> int {Represents one top-level surface in the file contract and should be read as part of the module boundary.
254cube_seriesproc cube_series(count: int) -> [int] {Represents one top-level surface in the file contract and should be read as part of the module boundary.
267polygonal_termproc polygonal_term(sides: int, index: int) -> int {Represents one top-level surface in the file contract and should be read as part of the module boundary.
283pentagonal_termproc pentagonal_term(index: int) -> int {Represents one top-level surface in the file contract and should be read as part of the module boundary.
287hexagonal_termproc hexagonal_term(index: int) -> int {Represents one top-level surface in the file contract and should be read as part of the module boundary.
291polygonal_seriesproc polygonal_series(sides: int, count: int) -> [int] {Represents one top-level surface in the file contract and should be read as part of the module boundary.
308fibonacci_termproc fibonacci_term(index: int) -> int {Represents one top-level surface in the file contract and should be read as part of the module boundary.
335fibonacci_sumproc fibonacci_sum(count: int) -> int {Represents one top-level surface in the file contract and should be read as part of the module boundary.
343fibonacci_seriesproc fibonacci_series(count: int) -> [int] {Represents one top-level surface in the file contract and should be read as part of the module boundary.
356is_fibonacciproc is_fibonacci(value: int) -> bool {Represents one top-level surface in the file contract and should be read as part of the module boundary.
367lucas_termproc lucas_term(index: int) -> int {Represents one top-level surface in the file contract and should be read as part of the module boundary.
394lucas_seriesproc lucas_series(count: int) -> [int] {Represents one top-level surface in the file contract and should be read as part of the module boundary.
407pell_termproc pell_term(index: int) -> int {Represents one top-level surface in the file contract and should be read as part of the module boundary.
434pell_seriesproc pell_series(count: int) -> [int] {Represents one top-level surface in the file contract and should be read as part of the module boundary.
451factorialproc factorial(value: int) -> int {Implements a counting or probability helper inside the math boundary.
467double_factorialproc double_factorial(value: int) -> int {Implements a counting or probability helper inside the math boundary.
487catalan_termproc catalan_term(index: int) -> int {Represents one top-level surface in the file contract and should be read as part of the module boundary.
499catalan_seriesproc catalan_series(count: int) -> [int] {Represents one top-level surface in the file contract and should be read as part of the module boundary.
516harmonic_numerator_termproc harmonic_numerator_term(index: int) -> int {Represents one top-level surface in the file contract and should be read as part of the module boundary.
523harmonic_denominator_termproc harmonic_denominator_term(index: int) -> int {Represents one top-level surface in the file contract and should be read as part of the module boundary.
530harmonic_denominatorsproc harmonic_denominators(count: int) -> [int] {Represents one top-level surface in the file contract and should be read as part of the module boundary.
547alternating_signproc alternating_sign(index: int) -> int {Implements a security-sensitive transformation in the crypto boundary.
559alternating_arithmetic_termproc alternating_arithmetic_term(first: int, step: int, index: int) -> int {Represents one top-level surface in the file contract and should be read as part of the module boundary.
566alternating_geometric_termproc alternating_geometric_term(first: int, ratio: int, index: int) -> int {Represents one top-level surface in the file contract and should be read as part of the module boundary.
577first_arithmetic_geproc first_arithmetic_ge(first: int, step: int, target: int) -> int {Represents one top-level surface in the file contract and should be read as part of the module boundary.
597first_geometric_geproc first_geometric_ge(first: int, ratio: int, target: int) -> int {Represents one top-level surface in the file contract and should be read as part of the module boundary.
621fibproc fib(index: int) -> int {Represents one top-level surface in the file contract and should be read as part of the module boundary.
625lucasproc lucas(index: int) -> int {Represents one top-level surface in the file contract and should be read as part of the module boundary.
629triangularproc triangular(index: int) -> int {Represents one top-level surface in the file contract and should be read as part of the module boundary.
633squareproc square(index: int) -> int {Represents one top-level surface in the file contract and should be read as part of the module boundary.
637cubeproc cube(index: int) -> int {Represents one top-level surface in the file contract and should be read as part of the module boundary.
641sequences_versionproc sequences_version() -> string {Represents one top-level surface in the file contract and should be read as part of the module boundary.
645sequences_readyproc sequences_ready() -> bool {Represents one top-level surface in the file contract and should be read as part of the module boundary.
649sequences_selftestproc sequences_selftest() -> bool {Represents one top-level surface in the file contract and should be read as part of the module boundary.

Exports

LineNameSignatureRole
670*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/sequences.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/arrays.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/arrays.vitl832Shares 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.

Neighbor modules